#
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, x, y):
return self.x + self.y
def __sub__(self, x, y):
return self.x - self.y
p1 = Point(1, 2)
p2 = Point(3, 4)
p3 = p1 + p2
print(p3)
OUTPUT: I get an an output which is looking for the parameter of y but i think i already pass y to it
Traceback (most recent call last):
File "C:##################################", line 18, in <module>
p3 = p1 + p2
TypeError: __add__() missing 1 required positional argument: 'y'