title: Python dynamic loop termination variable
body: <p>I want below piece of code to append 2's to the list 'a' until it gets the size of ten. However, it doesn't work in the way I wish. What am I missing?</p>
  
  <pre><code>a = [1,2]
  
  for ctr in range(0,len(a)):
      print ctr
      if len(a) &lt; 10:
          a.append(2)
  </code></pre>