class Rectangle: def __init__(self, x, y, weight, height): self.x = x self.y = y self.weight = weight self.height = height def intersection(self, other): if other.x < self.x + self.weight and other.y < self.y + self.height: return 5, 5, 10, 10 def get(self): print(self.x, self.y, self.weight, self.height) rect1 = Rectangle(0, 0, 10, 10) rect2 = Rectangle(5, 5, 10, 10) rect3 = rect1.intersection(rect2) rect3.get()