Suppose I have a code block like,
for i in range(15):
print(i)
i+=5
I expect the i value at each iteration should be i = 0,5,10, ....
Even though I am changing the iterator inside the code block of for loop, the value is not affecting the loop.
Can anyone explain the functionality happening inside?
iby theforstatement at the start of each iteration. You can monkey withiinside the loop, but it'll always get reset to the next value from the iterator.for i in range(0, 15, 5): print(i)