for loop question

Daniel Haus daniel.haus at gmail.com
Thu Jul 6 17:01:47 EDT 2006


just do:

for a in range(2, foo+1):
    print a

range(a, b) gives [a, a+1, a+2, ..., b-2, b-1]


bruce schrieb:

> hi..
>
> basic foor/loop question..
>
> i can do:
>
>  for a in foo
>   print a
>
> if i want to do something like
>   for a, 2, foo
>     print foo
>
> where go from 2, to foo..
>
> i can't figure out how to accomplish this...
>
> can someone point me to how/where this is demonstrated...
>
> found plenty of google for for/loop.. just not this issue..
> 
> thanks
> 
> -bruce




More information about the Python-list mailing list