Write Python Program to Find the Area of a Rectangle Using Classes


Topic: Write Python Program to Find the Area of a Rectangle Using Classes

Solution

class rectangle():
    def __init__(self,breadth,length):
        self.breadth=breadth
        self.length=length
    def area(self):
        return self.breadth*self.length
a=15
b=10
obj=rectangle(a,b)
print("Area of rectangle:",obj.area())



List all Python Programs