Python 3: Multiply a vector by a matrix without NumPy
The Numpythonic approach: (using numpy.dot in order to get the dot product of two matrices) The Pythonic approach: The length of your second for loop is len(v) and you attempt to indexing v based on that so you got index Error . As a more pythonic way you can use zip function to get the columns of a list then use starmap and mul within a list comprehension: