Where each component of aa is multiplied by the correspondent component of bb, and all the products are summed together, resulting in a number.

Within the elif clause, implement the above formula to compute the result of a scalar product and return the result. Remember that your implementation must be valid for any vector, independently from the number of components, when the method is inherited.

My implementation which does not work (the elif part):

elif type(self) == type(other):
kwargs = {i: getattr(self, i) * getattr(other, i) for i in vars(self)}
return self.__class__(**kwargs)

That formula is telling you to take the first component of vector a and multiply it by the first component of vector b and add it to the product of the second component of a times the second component of b and so on, up to the last component.

So you need to store all those products and return their sum, which is a number, not a vector.

The way you wrote kwargs works, but in the end you don’t need a dictionary to do that because you don’t care of the component once you compute the product.

Anyway, kwargs might be fine but the main problem is what you are returning.