Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39940 > unrolled thread
| Started by | Sven <svenito@gmail.com> |
|---|---|
| First post | 2013-02-26 09:58 +0000 |
| Last post | 2013-02-26 09:58 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: nested loops Sven <svenito@gmail.com> - 2013-02-26 09:58 +0000
| From | Sven <svenito@gmail.com> |
|---|---|
| Date | 2013-02-26 09:58 +0000 |
| Subject | Re: nested loops |
| Message-ID | <mailman.2538.1361872701.2939.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
Here's one solution
import time
count_timer = int(raw_input('how many seconds?: '))
for i in range(count_timer, 0, -1):
print i,
print "*" * i
time.sleep(1)
print 'blast off!'
On 25 February 2013 22:46, leonardo <tampucciolina@libero.it> wrote:
> hi everyone,
>
> i have the following program:
>
> import time
> count_timer = int(raw_input('how many seconds?: '))
> for i in range(count_timer, 0, -1):
> print i
> time.sleep(1)
> print 'blast off!'
>
>
> this is the result:
>
> how many seconds?: 5
> 5
> 4
> 3
> 2
> 1
> blast off!
>
> 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!
>
>
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>
--
./Sven
Back to top | Article view | comp.lang.python
csiph-web