Python Function Circle Area

By | January 9, 2023

Python Function Circle Area – Write a Python program to input radius of a circle. Calculate the area of the circle with the given radius.

Python Function Circle Area

Source code for Python Program to find Area of Circle

# Python Function Area of Circle

# Define the function to find area of circle

def area_of_circle(radius):
    if radius < 0:
        print('Error: radius must be non-negative')
    area = 3.14159 * radius**2
    return area

# input radius

radius = float(input('Enter radius of circle: '))

# call the function passing radius as argument

area = area_of_circle(radius)

# print answer that is area of circle

print('area of circle is: ', area)


Enter radius of circle: 2.35
area of circle is: 17.349430775000002


Leave a Reply

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