Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39940

Re: nested loops

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <svenito@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.084
X-Spam-Evidence '*H*': 0.84; '*S*': 0.01; 'cc:addr:python-list': 0.10; '"*"': 0.16; "'))": 0.16; '-1):': 0.16; 'result:': 0.16; 'row': 0.16; 'wrote:': 0.17; 'everyone,': 0.17; 'import': 0.21; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'url:mailman': 0.29; 'skip:& 10': 0.29; 'url:python': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'received:google.com': 0.34; 'received:209.85': 0.35; 'url:org': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'url:mail': 0.40; '2013': 0.84; 'beside': 0.84; 'blast': 0.84; 'off!': 0.84; 'stars': 0.84; 'to:addr:libero.it': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=1L66MYULgqHZoGR0DnrwOmnsULl2QBYkDO/IH10pBBA=; b=viwJH6yOjWYIv78jctWZdv3CqMLJhXR4Chl3wmn9yO8mp5drfAZHZ4MoZfbWuGLT+o GpsCSu8KaPkmphCHT2+GEwEDxK3xYzm/cyrSXPxvNRvWjfzT2caeEj3mpknsRZkbMUXL 8yzb3JWC3b+QOjfolFJk74H2Hb2D5t3znx0u2EYDs9IpBz72pU93sv0Sr1dRvYG00BfO NW6JOCiWcCFceK44pB9z4M61lxPErvNHyQEd68VQ9vjKs9yUW8RFfbhZqaNKv/M7owS4 JkTdNcTiKVv4q9q4JRYHks7SBxn6m8N+GhpFjGfOCi8Fdd216fJMx/j7t40JbaJY1gNj MjRQ==
MIME-Version 1.0
X-Received by 10.180.83.10 with SMTP id m10mr18056987wiy.5.1361872698967; Tue, 26 Feb 2013 01:58:18 -0800 (PST)
In-Reply-To <512BE9B3.7080409@libero.it>
References <512BE9B3.7080409@libero.it>
Date Tue, 26 Feb 2013 09:58:18 +0000
Subject Re: nested loops
From Sven <svenito@gmail.com>
To leonardo <tampucciolina@libero.it>
Content-Type multipart/alternative; boundary=f46d04428eb673c10a04d69db24e
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2538.1361872701.2939.python-list@python.org> (permalink)
Lines 115
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361872701 news.xs4all.nl 6904 [2001:888:2000:d::a6]:46671
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39940

Show key headers only | View raw


[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 comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: nested loops Sven <svenito@gmail.com> - 2013-02-26 09:58 +0000

csiph-web