Out of curiosity, I tried implementing a nested for loop using the same iterating variable in both the outer and inner for loops.
for i in range(3):
for i in range(4):
print("i = %s" % i)
What exactly is going on behind the scene here? BTW, the inner print is executed 12 times.
ifor looping. It just assigns current iteration value toibefore running loop body. That's why it runs fine. The print will only show inner for'sivalues though.ivariable. This is fine as long as you aren't doing anything with it.