python script modification

Discussion in 'Programmer's Corner' started by donut, Jun 13, 2012.

Thread Status:
Not open for further replies.
  1. donut

    Thread Starter Member

    May 23, 2012
    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?
Thread Status:
Not open for further replies.