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


Groups > comp.lang.python > #43820

Re: Novice Issue

Date 2013-04-18 08:29 -0400
From Dave Angel <davea@davea.name>
Subject Re: Novice Issue
References <0fa050c1-3a00-4c17-9fa6-b79a22485c7a@googlegroups.com> <36c94c5e-6ad1-4aba-b18c-61cf14cf102c@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.764.1366288199.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 04/18/2013 08:18 AM, Bradley Wright wrote:
>
>    <SNIP>
>>

> Secondly, thanks Wolfgang
> while raw_input not in ("quit", "q") - genius, i get your point clearly

But you have to combine his point with Chris's, don't forget the parens 
on the call to raw_input.  And if it were I, I'd also put a prompt 
string in the call.

    while raw_input("q to quit") not in ("quit", "q"):

>

If you've got a list, and each time through you want to add some item(s) 
to a list, you can use the following idiom:

result = []     #empty list
for   whatever in something:
     value = another
     result.append(value)

Then when you finish the list, you can examine the whole list.

-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Novice Issue Bradley Wright <bradley.wright.biz@gmail.com> - 2013-04-17 21:06 -0700
  Re: Novice Issue Chris Angelico <rosuav@gmail.com> - 2013-04-18 14:14 +1000
  Re: Novice Issue Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-04-18 08:58 +0000
  Re: Novice Issue Chris Angelico <rosuav@gmail.com> - 2013-04-18 19:06 +1000
  Re: Novice Issue Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-04-18 11:10 +0100
  Re: Novice Issue Bradley Wright <bradley.wright.biz@gmail.com> - 2013-04-18 05:18 -0700
    Re: Novice Issue Dave Angel <davea@davea.name> - 2013-04-18 08:29 -0400
  Re: Novice Issue Bradley Wright <bradley.wright.biz@gmail.com> - 2013-04-18 05:34 -0700
  Re: Novice Issue John Gordon <gordon@panix.com> - 2013-04-18 14:21 +0000

csiph-web