Apologies for the rather cryptic question, I couldn't find out how to express it better. But the question is really simple once you see my example.
>>> x,y = 0,0
>>> for x in range(x-1, x+2):
... for y in range(y-1, y+2):
... print(x,y)
...
-1 -1
-1 0
-1 1
0 0
0 1
0 2
1 1
1 2
1 3
My question is why y increases by 1 every time x increases by 1? I was expecting the following result:
>>> for x in range(-1,2):
... for y in range(-1, 2):
... print(x,y)
...
-1 -1
-1 0
-1 1
0 -1
0 0
0 1
1 -1
1 0
1 1
where y is -1, 0, 1 every iteration.
Can anyone explain why this behaviour is observed?
Thanks!