I am new to python and have faced this issue. What this program does is ask the user his or her age. The age has to be a number or else it will return a value error. I have used the try/except method to respond to the error, but i also want it so that the age the user enters is below a specific value(eg 200).
while True:
try:
age=int(input('Please enter your age in years'))
break
except ValueError:
print ('\n\n\n\nThat\'s not a valid Number.\nPlease try Again.\n\n\n\n')
except:
if age>=200:
print ('\n\n\n\nThat\'s not a valid Number.\nPlease try Again.\n\n\n\n')
print (f'Your age is {age}')
I tried this and a bunch of other stuff. Can anyone help?