Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python | cmath.pi constant

  • Last Updated : 09 Sep, 2019

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 library
import cmath
  
r = 5
# using cmath.pi constant
gfg = cmath.pi * r*r
  
print(gfg)

Output :

78.53981633974483

Example #2 :




# importing cmath library
import cmath
  
r = 3
# using cmath.pi constant
gfg = 2 * cmath.pi * r
  
print(gfg)

Output :

18.84955592153876

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!