add tests for adding Vectors

This commit is contained in:
2025-10-24 09:58:26 -05:00
parent 6d98c08e89
commit 6ba84c9859
2 changed files with 18 additions and 0 deletions

View File

@@ -30,6 +30,12 @@ class Vector(object):
s = "Vector(x=%s, y=%s, z=%s)" % (self.x, self.y, self.z)
return s
def __add__(self, other):
x = self.x + other.x
y = self.y + other.y
z = self.z + other.z
return self.__class__(x, y, z)
if __name__ == "__main__":
v1 = Vector(3, 4, 0)