For the following code:
x = range(10)
for i in x:
print(i)
for j in x:
print(">> %d" % j)
break
I would have expected the output to be:
0
>> 1
2
>> 3
..
but instead, it is:
0
>> 0
1
>> 0
2
>> 0
..
Why does range behave in this way?