Program to calculate the area of circle in Python


In this article, we are going to understand the python code to calculate the area of circle. To calculate the area of circle we should know the radius or diameter value of circle. Area is calculated by the given formula:

Area of circle = ∏*r2


∏ = pi having constant value = 3.14

r = radius of circle

area of circle


def area_circle(r):

    pi = 3.14

    r = float(r)

    area = pi*r*r

    print("Area of circle of radius {0} is {1}".format(r,area))

r = input("Please enter the radius of circle ")




Program to calculate the area of circle in Python


In the above python program, we have created a function area_circle() to calculate the area based on the input radius of circle. The radius is casted into float as the user might enter the float value and also as the pi has constant value 3.14, the arithmetic calculation of integer and float will give error.


  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.

    View all posts


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.