nested loops

Anssi Saari as at sci.fi
Tue Feb 26 20:39:42 CET 2013


leonardo <tampucciolina at libero.it> writes:

> how can i have it print  a row of stars beside each number, like this?:
>
> how many seconds?: 5
> 5 * * * * *
> 4 * * * *
> 3 * * *
> 2 * *
> 1 *
> blast off!

You could use the repetition operator * since you have the number of
repetitions needed in i. Alternatively, considering the subject, you'd
just add another for loop to print the stars and spaces.



More information about the Python-list mailing list