"Ian Egland" <echol...@gmail.com> wrote

I know that, should you want to get an int from the user, you use
int(input("Question!")). However, what if the user wasn't that savvy and
didn't realize he/she HAD to enter a number?

It's considered good UI design to phrase the prompt in such a way as to
help the user know what to input:

Thus:

x = int(input("Date(1-31): "))

or

s = int(input("Sex(m=1,f=2): "))

And then you have trhe responsibility to catch the error just in case...

This is all part of "industrial standard" programming. You have to make your programs foolproof, while bearing in mind that nature keeps buiding
bigger and better fools!


--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

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

Reply via email to