title: Increment for loop by adding counter to itself
body: <p>In java you can increment a for loop by adding the counter to itself.</p>
  
  <pre><code>for (int i = 1; i &lt; 20; i += i)
      System.out.print(i + " ")
  ----
  1 2 4 8 16
  </code></pre>
  
  <p>Is there a python equivalent?
  The following does not work.</p>
  
  <pre><code>for i in range(1, 10, i+=i):
      print(i, end=' ')
  ----
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Another question came up during experimentation.</p>
  
  <pre><code>for i in range(1,10,i):
      print(i,end=' ')
  print()
  
  for i in range(1,20,i):
      print(i,end=' ')
  print()
  
  for i in range(1,30,i):
      print(i,end=' ')
  print()
  
  for i in range(1,40,i):
      print(i,end=' ')
  print() 
  ----
  1 
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 
  1 20 
  1 21 
  </code></pre>
  
  <p>The main question is whether there is a python equivalent. <br>
  The other question is what is going on when the step is i.</p>