0

Can anyone explain me ..how its output is 8and 16

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)

1st Jun 2020, 10:13 AM
Vaibhav Someshwar Kanade
Vaibhav Someshwar Kanade - avatar
2 odpowiedzi
+ 4
result.x = first.x + second.x result.y = first.y + second.y
1st Jun 2020, 10:16 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
Thanks a lot
1st Jun 2020, 12:21 PM
Vaibhav Someshwar Kanade
Vaibhav Someshwar Kanade - avatar