Write a python Class to calculate area of a circle and print the vale for a radius


Topic: Write a python Class to calculate area of a circle and print the vale for a radius

Solution

class CircleArea():
    def __init__(self,radius):
        self.radius=radius
    def area(self):
        return 3.14 * self.radius * self.radius
a=6
obj=CircleArea(a)
print("Area of rectangle:",obj.area())



List all Python Programs