title: Matrix Transpose in Python
body: <p>I am trying to create a matrix transpose function for python but I can't seem to make it work.
  Say I have </p>
  
  <pre><code>theArray = [['a','b','c'],['d','e','f'],['g','h','i']]
  </code></pre>
  
  <p>and I want my function to come up with</p>
  
  <pre><code>newArray = [['a','d','g'],['b','e','h'],['c', 'f', 'i']]
  </code></pre>
  
  <p>So in other words, if I were to print this 2D array as columns and rows I would like the rows to turn into columns and columns into rows.</p>
  
  <p>I made this so far but it doesn't work</p>
  
  <pre><code>def matrixTranspose(anArray):
      transposed = [None]*len(anArray[0])
      for t in range(len(anArray)):
          for tt in range(len(anArray[t])):
              transposed[t] = [None]*len(anArray)
              transposed[t][tt] = anArray[tt][t]
      print transposed
  </code></pre>