title: Transpose a matrix using for loops
body: <p>I'm trying to create a code for transpose a given matrix:</p>
  <p>I come from Matlab, and I create this code:</p>
  <pre><code>A = [1,2,3,0,-2,0 ; 0,2,0,1,2,3];
  
  n = size(A);
  
  for i=1:n(2)
  
      for j=1:n(1)
  
       M(i,j) = A(j,i) 
  
      end
  end
  </code></pre>
  <p>In Python I'm tryng this:</p>
  <pre><code>M = [
      [1,2,3,0,-2,0],
      [0,2,0,1,2,3]
      ]
  
  LM = (len(M),len(M[0]))
  print(LM)
  
  Maux=[[]]
  print(Maux)
  
  
  for i in range(0,LM[1]):
      for j in range(0,LM[0]):
  
          Maux[i][j] = M[j][i]
          print(Maux)
  </code></pre>
  <p>But when I compile, the error is:</p>
  <p>Maux[i][j] = M[j][i]
  IndexError: list assignment index out of range</p>
  <p>Any idea?</p>