num = 0 while True: try: v = input("Enter a number: ") num = int(v) break except ValueError: # if v is a non-numeric string, the type of exception is "ValueError" print('Value Error') print('value of input ' + str(num))