10 minutes read

Python Program Code to Find Area of Circle


This is one of the most popular questions for beginners. You can easily write a basic Python code to find the area of a circle if you know the formula.

Area of Circle = 3.14*radius*radius

You need to read this for better understanding:

Python program to find square root.

Python Code: Find Area of Circle easily

This is a general approach to find the area of a circle in Python, the logic will work find in other programming languages also.


radius = float(input("Enter the radius of circle: "))
# Area of circle  = pie*radius*radius
area = 3.14*radius*radius
print("Area of circle with radius {0} is {1:.2f}".format(radius, area))


Enter the radius of circle: 5 Area of circle with radius 5.0 is 78.5

The logic of this code is simple.

We take input and convert it to float data type to preserve decimal points.

At line 3 we find the area of a circle using the formula.

Finally, we print the area of a circle with two-digit precision.

One line Solution in Python (Advanced)

Here is one line of Python program to find the area of circle easily.


print("Area of circle is {0}".format(3.14*(float(input("Enter the radius of circle: "))**2)))

The logic is simple.

First, we take the input and convert it to float. Then we calculate the area using the formula and print it.

Related Python Examples: