title: How to loop over a list of lists
body: <p>Recently I have come up with using a for loop to reform a list.</p>
  <p>First, I did this:</p>
  <pre><code>list1 = [[1],[2],[3]]
  list2 = []
  for x in list1:
      list2.append(x)
  print(list2)
  </code></pre>
  <p>And the output was:</p>
  <pre><code>[[1], [2], [3]]
  </code></pre>
  <p>Then, I tried：</p>
  <pre><code>list2 = []
  for x in list1:
      list2.append(x[0])
  </code></pre>
  <p>And the output was:</p>
  <pre><code>[1, 2, 3]
  </code></pre>
  <p>Could someone please explain to me what <code>x[0]</code> does in this for loop? I thought this index would mean only taking the first element in a list.</p>