Maybe a stupid idea

Gabriel Genellina gagenellina at softlab.com.ar
Wed Dec 31 14:23:18 EST 2003


At 31/12/2003 09:49, you wrote:

>I'm kind of newbie to programming, but I thought of something and I
>want some opinions on that.
>
>It's about a new instruction block to do some cycles.
>
>I thought about that because it's not very easy to program a cycle.
>Here is a simple example :
>
>b=0
>
>while b < 50:
>     b+=1
>     print "*" * b
>
>while b > 0:
>     b-= 1
>     print "*" * b
>
>It takes two while blocks to do a cycle.

No need for a new structure:

for i in range(10)+range(10,-1,-1):
     print '*'*i


Gabriel Genellina
Softlab SRL






More information about the Python-list mailing list