Why is the in for loop variable not changing?
2 answers
range()
prints a list of integers once. This list is then looped over for
. It is not recreated every iteration; that would be very inefficient.
You can use a loop instead while
:
i = 0
while i < (len(whole) / 2):
print whole
whole = whole[1:-1]
i += 1
the condition is while
checked at each iteration of the loop.
+8
source to share