Novice Issue

Dave Angel davea at davea.name
Thu Apr 18 08:29:37 EDT 2013


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



More information about the Python-list mailing list