python script modification

Status
Not open for further replies.

Thread Starter

donut

Joined May 23, 2012
51
I wrote a script that asks the user for a number and the programs tells you if the number entered is odd or even.

# the program will tell you if the number you entered is even, odd or other

number = input ("tell me the number: ")
if number %2 == 0:
print "number is even"
elif number %2 == 1:
print "number is odd"
else: print "number is strange"

I would like to expand upon this program. What if the person inputs A1. Obviously A1 is not a number. I want the program to return a statement saying that the number looks strange. How can i change the program to account for this?
 
Status
Not open for further replies.
Top