It is an interesting question, and you can understand it by that:
for v in a:
a[-1] = v
print(a[-1])
print(a)
actually a becomes: [0, 1, 2, 2] after loop
Output:
0
1
2
2
[0, 1, 2, 2]
I hope that helps you, and comment if you have further questions. : )