I am having trouble understanding why the counter variable even though incremented within the nested loop, is not having any effect on the number of times the parent loop runs!
The code below gives the output 0 1 2 when the increment inside the nested loop is supposed to stop it from executing the second and the third time.
for i in range(3):
print(i)
for j in range(2):
i = i + 2
Is the i inside the nested for pointing to a different i!