title: Using `for` in `range(x)` loop
body: <p><br> Shouldn't both blocks of code print similar results? Why is the range function inside of the inner loop reevaluated each time the inner for statement is reached while the range function in the outerloop is only evaluated once?</p>
  
  <pre><code>x = 4
  for j in range(x)
     for i in range(x)
         print i
         x = 2
  </code></pre>
  
  <p>Results<br>
  0<br>
  1<br>
  2<br>
  3<br>
  0<br>
  1<br>
  0<br>
  1<br>
  0<br>
  1<br></p>
  
  <p>I know the first 4 integers printed ( 0 - 3) are a result of the code
        for j in range(x): code but why are the the following also printed? <br>
  0<br>
  1<br>
  0<br>
  1<br>
  0<br>
  1<br>
  The code<br></p>
  
  <pre><code>x = 4
  for j in range(x):
      print i
      x = 5
  </code></pre>
  
  <p>Prints<br>
  0<br> 1<br> 2 <br>3 <br></p>
  
  <p>Additional Info
  Python 2.7 in IDLE</p>