I want to list a range of numbers and I\'m using the \"for i in range(start,stop,step)\".
def range():
P=36
for i in range(P+1,0,-1):
P=P-4
What's happening is that using range, creates you a list from 36 to 0 at the beggining and does a for loop 37 times. Your var P has no longer effect on the number of loops if you change it in your loop.
In your first case you'll have 36-37*4 = -112
In your second case you have your loop executed 9 times thats why you get 0 36 -9*4 = 0
:)
Try using xrange it should create a value for each loop and i think it will stop at 0.