l is passed as an argument to range function whose value is modified inside for loop, but the loop is going for 10 times instead of 5.
i = 0
l = 10
for i in range(l):
print i,l
l = l-1
The output is
0 10
1 9
2 8
3 7
4 6
5 5
6 4
7 3
8 2
9 1
While I expected
0 10
1 9
2 8
3 7
4 6
Does range() evaluates value for the first time only or something else is the reason?