Sep 5, 2009

Python Increment

To increment i by one,
i += 1

5 comments:

  1. THANK YOU THANK YOU THANK YOU

    ReplyDelete
  2. That only works as x+1 for a continuous one you need to use a while loop. For instance;

    x=0

    while x<50:
    >>x+=1
    >>print(x)
    >>if x==25:
    >>>>print(x, 'Halfway')
    >>elif x==50:
    >>>>print(x, 'Done')

    ReplyDelete

So, what did you think?