Bryan Fodness wrote:
>     speed = int(raw_input(prompt))
> 
>  
> Is this how ALL known integers should be input?

Yes, with probably a try/except block and a while loop around it to 
handle invalid input.

There are two good reasons for doing this instead of using input:
- it guarantees that the input is in fact an integer (raises ValueError 
otherwise)
- it protects against malicious input (you can do a lot of damage in an 
input(), whatever you type is eval'ed)

For input of unknown integers, you are on your own, Python does not have 
anything built-in for that ;-)

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

Reply via email to