Novice Issue

Chris Angelico rosuav at gmail.com
Thu Apr 18 00:14:41 EDT 2013


On Thu, Apr 18, 2013 at 2:06 PM, Bradley Wright
<bradley.wright.biz at gmail.com> wrote:
> Good Day all, currently writing a script that ask the user for three things;
> 1.Name
> 2.Number
> 3.Description
> I've gotten it to do this hurah!
>
> print "Type \"q\" or \"quit\" to quit"
> while raw_input != "quit" or "q":

You'll want to actually _call_ that function: raw_input()

>
>     print ""
>     name = str(raw_input("Name: "))
>     number = str(raw_input("Number: "))
>     description = str(raw_input("Description: "))

raw_input already returns a string, so the str() is redundant here.

> but here a few things, can anyone help me on figuring out how to at the users whim print out all of the names, numbers and descriptions. this is sort of an information logger.
>
> additionally, minor issue with getting script to stop when q or quit is typed
>
> any help would be greatly appreciated

Once you have all the values, you just need to figure out what you're
trying to do with them. Do you need to retain them till the end of the
loop? If so, consider a list or dictionary. Or do you need to work
with them right there inside the loop? What are you needing to
accomplish?

ChrisA



More information about the Python-list mailing list