num = 0 low_limit = 0 hi_limit = 10 while True: try: v = input("Enter a number: ") num = int(v) if num >= low_limit and num <= hi_limit: break else: print('Value out of range.') except ValueError: # if v is a non-numeric string, the type of exception is "ValueError“ print('Value Type Error.') print('value of input ' + str(num))