### Python program to find the area and perimeter of a rectangle

### Problem Definition:

Write a python program that has class named Rectangle with attributes length and beadth and two methods area and perimeter they return area and perimeter respectively.

### Program source code for Python program to find the area and perimeter of a rectangle

class Rectangle: def __init__(self, length, breadth): self.length = length self.breadth = breadth def display(self): print ("Length of Rectangle is: ", self.length) print ("Breadth of Rectangle is: ", self.breadth) def area(self): return (self.length*self.breadth) def perimeter(self): return (2*self.length + 2*self.breadth) l = int (input("Enter the length of Rectangle: ")) b = int (input("Enter the breadth of rectangle: ")) r1 = Rectangle(l , b) print ("Rectangle object details are:") r1.display() print("") print ("Area of Rectangle is: ", r1.area()) print("") print ("Perimeter of Rectangle is: ", r1.perimeter())

### Output:

Enter the length of Rectangle: 10 Enter the breadth of rectangle: 5 Rectangle object details are: Length of Rectangle is: 10 Breadth of Rectangle is: 5 Area of Rectangle is: 50 Perimeter of Rectangle is: 30