1class Rectangle:
2 def __init__(self, length, width):
3 self.length = length
4 self.width = width
5
6 def area(self):
7 return self.length * self.width
8
9 def perimeter(self):
10 return 2 * self.length + 2 * self.width
11
12# Here we declare that the Square class inherits from the Rectangle class
13class Square(Rectangle):
14 def __init__(self, length):
15 super().__init__(length, length)
16