title: Why Python for loop doesn't work like C for loop?
body: <p>C:</p>
  
  <pre><code># include &lt;stdio.h&gt;
  main()
  {
      int i;
      for (i=0; i&lt;10; i++)
      {
             if (i&gt;5) 
             {
               i=i-1;     
               printf("%d",i);
             } 
      }
  }
  </code></pre>
  
  <p>Python: </p>
  
  <pre><code>for i in range(10):
     if i&gt;5: i=i-1
     print(i)
  </code></pre>
  
  <p>When we compile C code, it goes into a infinite loop printing 5 forever, whereas in Python it doesn't, why not?</p>
  
  <p>The Python output is:</p>
  
  <blockquote>
    <p>0 1 2 3 4 5 5 6 7 8</p>
  </blockquote>