– Addition
– Subtraction
[1 3] – [5 1] = [-4 2]
– Scalar Multiplication
2, 1, 1/2, -3/2
[8.218 -9.341]+[-1.129 2.111]=[7.089 -7.23]
[7.119 8.215] – [-8.223 0.878]=[15.342 7.337]
7.41[1.671 -1.012 -0.318]= [12.382 -7.499 -2.356]
def plus(self, v): new_coordinates = [x+y for x,y in zip(self.coordinates, v.coordinates)] return Vector(new_coordinates) def minus(self, v): new_coordinates = [x-y for x,y in zip(self.coordinates, v.coordinates)] return Vector(new_coordinates) def times_scalar(self, c): new_coordinates = [c*x for x,y in zip(self.coordinates, v.coordinates)] return Vector(new_coordinates) def __str__(self): return 'Vector: {}'.format(self.coordinates) def __eg__(self, v): return self.coordinates == v.coordinates