Oct-06-2019, 02:16 PM
Hello!
I am new in programming in python. I got a homework to create class MyVector,
- constructor will accept (to self) one parameter (it will be one-dimensional array)
- method get_vector(self) return one-dimensional array containing the vector elements
- with special method __mul__(self,other) implement the dot product of two objects MyVector (the output is a scalar, so one number)
btw I cant import other modules.
I have this:
[Image: ZvD49DyKCd.jpg]
In my mind, get_vector(self) is right. But __mul__(self,other) is not working properly. Do you know how to make things right?

I am new in programming in python. I got a homework to create class MyVector,
- constructor will accept (to self) one parameter (it will be one-dimensional array)
- method get_vector(self) return one-dimensional array containing the vector elements
- with special method __mul__(self,other) implement the dot product of two objects MyVector (the output is a scalar, so one number)
btw I cant import other modules.
I have this:
[Image: ZvD49DyKCd.jpg]
In my mind, get_vector(self) is right. But __mul__(self,other) is not working properly. Do you know how to make things right?
