Pythoncmath.pi Constant
Example
Print the value of PI:
#Import cmath Library
import cmath
# Print the value of pi
print (cmath.pi)
Try it Yourself »import cmath
# Print the value of pi
print (cmath.pi)
Definition and Usage
Thecmath.pi constant returns the value pi: 3.141592653589793.
It is defined as the ratio of the circumference to the diameter of a circle.
Note: Mathematically pi is represented byπ.
Syntax
cmath.pi
Technical Details
| Return Value: | Afloat value, 3.141592653589793, representing the mathematical constantPI |
|---|---|
| Python Version: | 1.5 |

