Apr-22-2020, 06:15 AM
class Rectangle(): def __init__(self, x, y): self.x = x self.y = y def dRec_area(self1, self2): area = (self1.x * self1.y) + (self2.x * self2.y) return area x1 = input("Please insert the width: ") y1 = input("Please insert the length: ") rectangle1 = Rectangle(x1, y1) x2 = input("Please insert the width: ") y2 = input("Please insert the length: ") rectangle2 = Rectangle(x2, y2) print(rectangle1.rectangle2.dRec_area())How to apply the method on two objects?