Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40044
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <maillists@nic.fi> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | UNSURE 0.326 |
| X-Spam-Level | *** |
| X-Spam-Evidence | '*H*': 0.45; '*S*': 0.10; 'range.': 0.16; 'received:fi': 0.16; 'row': 0.16; 'sec': 0.16; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; '---': 0.26; 'actual': 0.28; 'writes:': 0.29; 'included': 0.29; 'print': 0.32; 'to:addr :python-list': 0.33; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'range': 0.60; 'received:62': 0.62; 'note:': 0.64; 'received:130': 0.75; 'upper': 0.75; 'beside': 0.84; 'blast': 0.84; 'off!': 0.84; 'stars': 0.84 |
| Date | Wed, 27 Feb 2013 09:02:21 +0200 |
| From | "K. Elo" <maillists@nic.fi> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: nested loops |
| References | <mailman.2537.1361871951.2939.python-list@python.org> <vg338wirhj5.fsf@coffee.modeemi.fi> |
| In-Reply-To | <vg338wirhj5.fsf@coffee.modeemi.fi> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Mailman-Approved-At | Wed, 27 Feb 2013 11:02:00 +0100 |
| 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.2601.1361959322.2939.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361959322 news.xs4all.nl 6905 [2001:888:2000:d::a6]:47394 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40044 |
Show key headers only | View raw
Hi!
> leonardo <tampucciolina@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!
--- snip ---
sec = int(input("How many seconds? "))
for i in range(0,sec):
print str(sec-i)+":"+" *"*(sec-i)
print "blast off!"
--- snip ---
Please note: the value for the upper bound is not included in the range.
In my example, the actual range is from 0 to 4.
HTH,
Kimmo
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
nested loops leonardo <tampucciolina@libero.it> - 2013-02-25 23:46 +0100
Re: nested loops Alister <alister.ware@ntlworld.com> - 2013-02-26 14:36 +0000
Re: nested loops Anssi Saari <as@sci.fi> - 2013-02-26 21:39 +0200
Re: nested loops "K. Elo" <maillists@nic.fi> - 2013-02-27 09:02 +0200
csiph-web