# Python Program to Find Area of Circle

In this post, we will learn how to find the area of a circle using the Python Programming language.

As we know, the area of a circle is Ï€r2, where r is the radius of the circle and Ï€ = 22/7 or 3.14.Â

Since Ï€ is a constant, we need to take only the radius value as input.

We can import the value of Ï€ using a math module or assign the value of Ï€ to a separate constant variable.

This tutorial takes the radius of the circle from the user and calculates the area of the circle using the following approaches:

1. Using Constant Ï€
2. Using mathÂ Module

So, without further ado, letâ€™s begin this tutorial.

## Python Program to Find Area of Circle Using Constant Ï€

```# Python Program to Find Area of Circle Using Constant Ï€

PI = 3.14
r = float(input("Enter the radius of the circle: "))
area = PI * r * r

print("Area of the circle = %.2f" %area)

```

Output

``````Enter the radius of the circle: 14
Area of the circle = 615.44
``````

## How Does This Program Work?

1. In this program, we store the value of Ï€ in the PI named constant variable.
2. Now, the user is asked to enter the radius of the circle. It is stored in the r named variable.
3. The area of the circle is calculated using the formula Ï€r2. The area of the circle is stored in the area named variable.
4. The calculated area of the circle is printed up to 2 decimal places with the help of %.2f format specifier.

## Python Program to Find Area of Circle Using math Module

In the above program, we have stored the value of Ï€ in a separate variable. To get more precise and accurate results, we will use the math module.

Python has a built-in module called math that provides access to different mathematical constants and functions. It also contains the value of Ï€.

```# Python Program to Find Area of Circle Using math Module
import math

r = float(input("Enter the radius of a circle: "))
area = math.pi * r * r

print("Area of the circle = %.2f" %area)
```

Output

``````Enter the radius of a circle: 7
Area of the circle = 153.94
``````

To use the value of Ï€, use math.pi in the program.

## Summary

After going through this post, I hope you understand how to find the area of a circle using the Python Programming language.