add tests for adding Vectors
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user