Skip to main content

Create a Python class named Circle constructed by a radius and two methods that will compute the area and the perimeter of a circle.

· One min read
Kaustubh Kulkarni
file.py
class Circle():
def __init__(self, r):
self.radius = r
def area(self):
return self.radius ** 2 * 3.14
def perimeter(self):
return 2 * self.radius * 3.14
NewCircle = Circle(float(input("Please Enter Radius of Circle : ")))
print("Area of Circle is :{} ".format(NewCircle.area()))
print("Perimeter of Circle is :{} ".format(NewCircle.perimeter()))

Output:

Output

Please Enter Radius of Circle : 5
Area of Circle is :78.5
Perimeter of Circle is :31.400000000000002