Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class Rectangle:
  2. def __init__(self, x, y, weight, height):
  3. self.x = x
  4. self.y = y
  5. self.weight = weight
  6. self.height = height
  7.  
  8. def intersection(self, other):
  9. if other.x < self.x + self.weight and other.y < self.y + self.height:
  10. return 5, 5, 10, 10
  11. def get(self):
  12. print(self.x, self.y, self.weight, self.height)
  13. rect1 = Rectangle(0, 0, 10, 10)
  14. rect2 = Rectangle(5, 5, 10, 10)
  15. rect3 = rect1.intersection(rect2)
  16. rect3.get()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement