## Find the Area of a circle in python :

We know that the area of a circle is π r² , where “r” is the radius of the circle. Since π is constant , to calcutate the area, we need only the radius value from the user . The value of π is 3.1415 upto fourth decimal places. We can use this value or we can use the inbuilt ‘math’ module . Let’s try to calculate the area using both of these method :

## Calculate circle area using constant π :

PI = 3.14 r = float(input('Enter the radius of the circle :')) area = PI * r * r print("Area of the circle is : %.2f" %area)

Output :

Enter the radius of the circle :3 Area of the circle is : 28.26

## Using math module :

Now, let’s find the area of a circle using math module of python :

import math r = float(input('Enter the radius of the circle :')) area = math.pi * r * r print("Area of the circle is : %.2f" %area)

Output :

Enter the radius of the circle :3 Area of the circle is : 28.27

Here, we have imported the ‘math’ module and use the value of math.pi for π .

Similarly, we can also find out the circumference of a circle using 2 * π * r