Changing the number of iterations in a for loop
I have code like this: loopcount = 3 for i in range(1, loopcount) somestring = '7' newcount = int(somestring) loopcount = newcount so what I want is to modify the range of the for 'inside' the loop. I wrote this code expecting the range of the for loop would change to (1,7) during the first loop, but it didn't happen. Instead, no matter what number I put in, it only runs 2 times. (I want 6 times.. in this case) I checked the value using print like this: loopcount = 3 for i in range(1, loopcount) print loopcount somestring = '7' newcount = int(somestring) loopcount = newcount print loopcount