I have my first task on python class:
- Create a module
vectors.py - It will be a class definition
MyVector - constructor will accept one parameter, which will be one-dimensional array.
get_vector()method returns one-dimensional array containing the elements of the vector.- using a special method
__ mul__(self, other)implement the dot product of two objects of type MyVector. The output is a scalar (a single number).
Now it's seems like this:
class MyVector:
def __init__(self,vector=[]):
self.vector=vector
def get_vector(self):
return (self.vector)
def __mul__(self,other):
dot=sum(p*q for p,q in zip(self.vector, WHAT IS HERE?))
return(dot)
I have first vector, but how can I initialize second?