[Tutor] Input checking [letters or numbers]
p.atmatzidis at gmail.com
Fri Dec 23 19:15:46 CET 2005
Can someone provide me with an error checking example about an x
variable that needs to be number only? I used something like:
print "WARNING: If you don't understand why this must be unique,
exit and read the manual."
userid = input("x : ")
I know that "input" accepts only numbers, but I don't want the program
to break if someone puts other chars in it. I want to, print "Only
numbers are accepted." which is easy. But still I can't understand how
to do the check using if/elif/else statements.
More information about the Tutor