[Tutor] while statement

Sean 'Shaleh' Perry shalehperry@attbi.com
Thu May 1 03:39:06 2003


> and this is repeated until n = N.
>
> I know that the while statement needs to be used but I
> am unsure of the exact syntax. I am having problems
> incrementing n by 1 in each iteration.
>

while n != N: # or maybe n < N
   do_stuff
   n = n + 1 # or with newer (2.2+) n += 1