# This program asks the user to input a number from 1 to 10. # If input value is not a number, an exception is raised, # if the input value is out of the range, an error message is displayed def main(): n = 0 while not 1 <= n <= 10: n=raw_input('Enter a number from 1 to 10:') if n.isdigit() == False: raise ValueError('it is not a number') n=int(n) if n<1 or n>10: print 'Your number should be from 1 to 10' main()