Python Find Area of Circle using User Defined Function

By | March 23, 2020

Topic: Python Find Area of Circle using User Defined Function

The area of a circle is given by the formula:

area = PI x R2

where PI is the popular math constant = 3.14159 and R is the radius of the circle.

We will use the math module in this Python program. Import math module and use math.pi. To calculate R squared we will use the power operator ** with 2 as power.

We will use the Python expression for area of circle formula:

area= math.p * radius**2

# Python program to find
# area of circle when
# radius is given
# with the help of user defined function

import math
def circle_area(radius):
    return math.pi * radius ** 2

def main():
    radius = float(input("Enter value for base of triangle:"))
    area = circle_area(radius)
    area = round(area,4)
    print("The Area of circle is : ",area)


Output Python Find Area of Ciircle

Enter value for base of triangle:7.3
The Area of circle is :  167.4155

Leave a Reply

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