I have this code:
class Point:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __add__(self, other):
return Point((self.x ** 2) + (other.x ** 2), (self.y ** 2) + (other.y ** 2), (self.z ** 2) + (other.z ** 2))
def __str__(self):
return f'x: {self.x}, y: {self.y}, z: {self.z}'
pt1 = Point(3, 4, -5)
pt2 = Point(-4, 1, 3)
pt3 = pt1 + pt2
print(pt1 == pt2)
Now I want to change ==
in the last line to >
or <
, but this error was raised:
TypeError: '>' not supported between instances of 'Point' and 'Point'