title: How can I turn this 'while' loop into a 'for' loop?
body: <p>I'm working through LPTHW, on exercise 33, and on the very last study drill, they ask to change the code I have to a 'for' loops, rather than the 'while' loop I've written. Here's the code I've come up with:</p>
  
  <pre><code>numbers = []
  
  def loop(i, x, new_num):
      while i &lt; x:
          print "At the top i is %d" % i
          numbers.append(i)
  
          i = i + new_num
          print "Numbers now: ", numbers
          print "At the bottom i is %d" % i
  
  
      print "The numbers: "
  
      for num in numbers:
          print num
  
  loop(0, 10, 6)
  </code></pre>
  
  <p>Now the study drill instructs me to, "Now, write it to use for- loops and range instead. Do you need the incrementor in the
  middle anymore? What happens if you do not get rid of it?"</p>
  
  <p>This is how far I've managed to get, but I've got no idea if I'm going in the right direction. Basically just shooting in the dark:</p>
  
  <pre><code>numbers = []
  new_numbers = [0]
  def loop2():
      for i in new_numbers: 
          print "At the top i is %d" % i
          numbers.append(i)
  </code></pre>
  
  <p>I don't know where to insert a 'range' function either. If I managed to turn this into a 'for' loop that did exactly what this 'while' loop code does, what would it look like? </p>