This is a Python Program to compute the area and perimeter of the circle using classes.

The program takes the radius from the user and finds the area of the circle using classes.

1. Take the value of radius from the user.

2. Create a class and using a constructor initialise values of that class.

3. Create a method called as area which returns the area of the class and a method called as perimeter which returns the perimeter of the class.

4. Create an object for the class.

5. Using the object, call both the methods.

6. Print the area and perimeter of the circle.

7. Exit

Here is the source code of the Python Program to take the radius from the user and find the area of the circle using classes. The program output is also shown below.

import math class circle(): def __init__(self,radius): self.radius=radius def area(self): return math.pi*(self.radius**2) def perimeter(self): return 2*math.pi*self.radius r=int(input("Enter radius of circle: ")) obj=circle(r) print("Area of circle:",round(obj.area(),2)) print("Perimeter of circle:",round(obj.perimeter(),2))

1. User must enter the value of radius.

2. A class called circle is created and the __init__() method is used to initialize values of that class.

3. A method called as area returns math.pi*(self.radius**2) which is the area of the class.

3. Another method called perimeter returns 2*math.pi*self.radius which is the perimeter of the class.

5. An object for the class is created.

6. Using the object, the methods area() and perimeter() are called.

7. The area and perimeter of the circle is printed.

Case 1: Enter radius of circle: 5 Area of circle: 78.54 Perimeter of circle: 31.42 Case 2: Enter radius of circle: 10 Area of circle: 314.16 Perimeter of circle: 62.83

**Sanfoundry Global Education & Learning Series – Python Programs.**

To practice all Python programs, __here is complete set of 150+ Python Problems and Solutions__.