Python Tutorial Python Advanced Python References Python Libraries

Python cmath - pi Constant



The Python cmath.pi constant returns the value of 𝜋 to the available precision. It returns the value of 𝜋 as 3.141592653589793.

Syntax

cmath.pi

Parameters

No parameter is required.

Return Value

Returns the value of 𝜋 to the available precision.

Example:

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

import cmath

print("Value of pi:", cmath.pi)

The output of the above code will be:

Value of pi: 3.141592653589793

❮ Python cMath Module

5