Python Tutorial Python Advanced Python References Python Libraries

Python math - pi Constant



The Python math.pi constant is used to return the value of 𝜋 to the available precision. It returns the value of 𝜋 as 3.141592653589793.

Syntax

math.pi

Parameters

No parameter is required.

Return Value

Returns the value of 𝜋 to the available precision.

Example:

In the example below, math.pi constant is used to return the value of 𝜋 to the available precision.

import math

print(math.pi)
print("Area of the circle with radius 1.0 is:", math.pi*1*1)

The output of the above code will be:

3.141592653589793
Area of the circle with radius 1.0 is: 3.141592653589793

❮ Python Math Module