The python interpreter differentiates between spaces and TAB-s. So even though two lines may look like they are indented the same width, if one is done with spaces, and the other with TAB-s python will complain. Make sure to be consistent and only use one or the other. One way to get your code to consistently use spaces, is to open it in vim and run the command ":retab"
No. You may only use the imporated libraries and the built-in functions .
No.
Yes.
No. You can assume lists are of equal length.
Assign the value corresponding to the last occurance of the key.
A vector is just a sequence. So you should get the same thing as calling "Vector(['H', 'E', 'L', 'L', 'O'])".
"v1+v2" builds a new vector equal to the sum of v1 and v2 and returns it. The original vectors v1 and v2 are unchanged. "v1+=v2" changes the vector v1 to qual the usm of v1 and v2. v2 remains unchanged.
See previous.
If you're having trouble with something like this (6,8,2)+Vector([4,-3,2]) you probably didn't implement the __radd__ function.
Throw a value error.
Yes.
No.
You can assume that only vectors of equal length will be compared.
Here's a handy example thanks to Valentin Robert:
v = Vector([1, 2, 3]) w = Vector([3, 2, 1]) v > w is False w > v is False v == w is False v >= w is True w <= v is True
>>> Vector([1,2,3,4,5])[3:5] Vector([4, 5])
Instead of super(Vector, self).__lt__(other) try super(Vector, self) < other
See previous.