title: How to change for-loop iterator variable in the loop in Python?
body: <p>I want to know if is it possible to change the value of the iterator in its for-loop?</p>
  
  <p>For example I want to write a program to calculate prime factor of a number in the below way :</p>
  
  <pre><code>def primeFactors(number):
      for i in range(2,number+1):
          if (number%i==0)
              print(i,end=',')
              number=number/i 
              i=i-1 #to check that factor again!
  </code></pre>
  
  <p>My question : Is it possible to change the last two line in a way that when I change <code>i</code> and <code>number</code> in the <code>if</code> block, their value change in the <code>for</code> loop!</p>
  
  <p>Update: Defining the iterator as a <code>global</code> variable, could help me? Why?</p>