I’m new in programming and I have an issue when doing the input validation.
My program requires to input number from 1 to 10 or the letter y but it seems that I cannot do an error handler for this.
def checkingInput():
while True:
try:
a = input()
if 10 >= a >= 1 or a == 'y':
return value
else:
print('Invalid input!')
except NameError:
print('Name error!Please try again!')
except SyntaxError:
print('Syntax Error!Please try again!')
as jamylak suggested change the if condition to :
program: