On Dec 5, 2007 4:46 PM, Bryan Fodness <[EMAIL PROTECTED]> wrote:
> On Dec 5, 2007 4:16 PM, Jerry Hill <[EMAIL PROTECTED]> wrote:
> > speed = int(raw_input(prompt))
>
>
> Is this how ALL known integers should be input?

I don't think I understand the question.  If you are prompting your
user to enter an integer from the console, then yes, this is the
general way you should do it, probably wrapped in a try/except block.

You certainly don't have to do it all in one line like that.  Instead,
you could split it up into component parts, like this:

prompt = "Please enter a number between 1 and 10:\n"
user_input = raw_input(prompt)
try:
    user_number = int(user_input)
except ValueError:
    print "You did not enter a number."

-- 
Jerry
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to