I'm trying to get my little user-input program to recognize that words aren't numbers.
Without any logic parameters the program just crashes when you put in anything but a number, I'm attempting to allow the user to try again and put in a number using a while loop, but I keep getting syntax errors when I try to define valid_age as any number between 1 and 200.
The coding for the defining of valid_age and the while loop follows.
age = 0
[B]def valid_age (range(1, 200))[/B]
age = int(input('How old are you today? '))
while age != valid_age:
print()
print('That is not a valid age!')
age = int(input('How old are you today? '))
else:
age10 = int(age) + 10
print()
print('In 10 years you will be ' + str(age10) + ' years old.')
print()