Python | cmath.pi constant
With the help of cmath.pi constant, we can use this constant value in the calculation of area of circle, perimeter of circle and etc.
Syntax :
cmath.pi
Return : Return the pi value.
Example #1 :
In this example we can see that by using cmath.pi constant, we are able to drive the mathematical formulas very easily.
# importing cmath libraryimport cmath r = 5# using cmath.pi constantgfg = cmath.pi * r*r print(gfg) |
Output :
78.53981633974483
Example #2 :
# importing cmath libraryimport cmath r = 3# using cmath.pi constantgfg = 2 * cmath.pi * r print(gfg) |
Output :
18.84955592153876
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.


