Python math.pi Constant
Example
Print the value of PI:
# Import math Library
import math
# Print the value of pi
print (math.pi)
Try it Yourself »
Definition and Usage
The math.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
math.pi
Technical Details
Return Value: | A float value, 3.141592653589793, representing the mathematical constant PI |
---|---|
Python Version: | 1.4 |