title: for loop in c++ and python
body: <p>I am very new to python.I had a small query about for loop in c++ and python.In c,c++ if we modify the variable <code>i</code> as shown in below example ,that new value of <code>i</code> reflects in the next iteration but this is not the case in  for loop in python.So ,how to deal with it in python when it is really required to skip some iterations without actually using functions like <code>continue</code> ,etc.</p>
  
  <p><code>for loop in c++</code></p>
  
  <pre><code>for(int i=0;i&lt;5;++i)
  {   
     if(i==2)
      i=i+2;
  
     cout&lt;&lt;i&lt;&lt;endl;
  }
  </code></pre>
  
  <p><code>Output</code></p>
  
  <pre><code>0
  
  1
  
  4
  </code></pre>
  
  <p><code>for loop in python</code></p>
  
  <pre><code>for i in range(5):
       if i==2:
          i=i+2
       print i
  </code></pre>
  
  <p><code>Output</code></p>
  
  <pre><code>0
  
  1
  
  4
  
  3
  
  4
  </code></pre>