0

Could anyone explain this code

class Vector2D: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): return Vector2D(self.x + other.x, self.y + other.y) first = Vector2D(5, 7) second = Vector2D(3, 9) result = first + second print(result.x) print(result.y) PYTry it Yourself

9th Dec 2020, 6:19 PM
R Janani Priya
1 Odpowiedź
+ 5
x y 5 7 3 9 ----------- 8 16
9th Dec 2020, 6:23 PM
Oma Falk
Oma Falk - avatar