0
The Vector 2D class takes 3 arguments - self, x and y. The __add__ magic method returns type of calculation after taking s aelf and other as argument. First = Vector2D(5, 7) Where 5 is self.x and 7 is self.y Second = Vector2D(3, 9) Where 3 is other.x and 9 is other.y Result = first + second Remember what __add__ returns (self.x + other.x, self.y + other.y) print (result.x) prints out the x attributes i.e self.x + other.x and print (result.y) does the same thing. I hope this helps
6th May 2020, 7:26 AM
Fatunmbi Teniola