title: Printing Out a Nested List Using Nested Loops in Python
body: <p>I am trying to understand how to print the following table of numbers to get the desired output:</p>
  <pre><code> tableData =  [ 
  
   ['1','2','3','4'],
   ['11','12','13','14'],
   ['21','22','23','24']
  
  ]
  </code></pre>
  <p>The output:</p>
  <pre><code>1 11 21 
  2 12 22 
  3 13 23 
  4 14 24 
  </code></pre>
  <p>After digging around a bit, I was able to write this following code that gives me the correct answer:</p>
  <pre><code>for row in range(len(tableData[0])):
      for item in range(len(tableData)):
          print(tableData[item][row], end = &quot; &quot;)
      print('')
  </code></pre>
  <p>However, I do not understand one thing.
  In the first line of code, why is the [0] needed? When I remove it the code does not print out the last line 4, 14, 24, and I do not understand why.
  If someone can explain the logic of adding [0] here I would appreciate it a lot.</p>