title: Python 3: Multiply a vector by a matrix without NumPy
body: <p>I'm fairly new to Python and trying to create a function to multiply a vector by a matrix (of any column size).
  e.g.:</p>
  
  <pre><code>multiply([1,0,0,1,0,0], [[0,1],[1,1],[1,0],[1,0],[1,1],[0,1]])
  
  [1, 1]
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>def multiply(v, G):
      result = []
      total = 0
      for i in range(len(G)):
          r = G[i]
          for j in range(len(v)):
              total += r[j] * v[j]
          result.append(total)
      return result  
  </code></pre>
  
  <p>The problem is that when I try to select the first row of each column in the matrix (r[j]) the error 'list index out of range' is shown. Is there any other way of completing the multiplication without using NumPy?</p>