Python Program to Find the Area and Perimeter of the Circle using Class

bookmark

import math
 
radius = float(input("Enter the radius of the circle: "))
 
# Calculate the area of the circle
area = math.pi * radius ** 2
 
# Calculate the perimeter of the circle
perimeter = 2 * math.pi * radius
 
print("Area of the circle:", area)
print("Perimeter of the circle:", perimeter)

 

Output


Enter the radius of the circle: 5
Area of circle: 78.54
Perimeter of circle: 31.42