title: understanding the creation of the array of lists in python
body: <p>I was reading about how to declare a matrices in python and I find this question <a href="https://stackoverflow.com/questions/6667201/how-to-define-two-dimensional-array-in-python">How to define two-dimensional array in python</a></p>
  
  <p>It's work with me, but I understanding what was done here in part, what I don't understanding is the parameter before the "for" in both loops...So I going to my terminal and testing parts of this for one by one, so when I type:</p>
  
  <pre><code>0 for x in range(w):
  </code></pre>
  
  <p>I receive:</p>
  
  <blockquote>
    <p>File "&lt; stdin >", line 1</p>
  </blockquote>
  
  <p>So I try:</p>
  
  <pre><code>[0 for x in range(w)] for y in range(h):
  </code></pre>
  
  <p>receive:</p>
  
  <blockquote>
    <p>File "&lt; stdin >", line 1
        [0 for x in range(w)] for y in range(h):</p>
  </blockquote>
  
  <p>So I try:</p>
  
  <pre><code>[0 for x in range(w)]
  </code></pre>
  
  <p>and</p>
  
  <pre><code>[[0 for x in range(w)] for y in range(h)] 
  </code></pre>
  
  <p>and it's work...</p>
  
  <p>So why the loop works when I put the brackets and not work without the brackets?</p>
  
  <p>Thanks in advance.</p>