My problem here is that if the user inputs a value that is not an integer, it throws a ValueError: invalid literal for int() with base 10:'example'
i want to handle this exception if the user inputs a string or float based value and return print("Sorry thats not right, try again") and replay the function.
how can this be accomplished?
I fear it is because the input function is posed as an argument inside the configselect() function that this might not be possible?
choice = [1, 2, 3]
def configselect(choice):
if choice == 1:
print("you chose 962")
elif choice == 2:
print("you chose Audience")
elif choice == 3:
print("you chose mAP")
else:
print('Thats not a valid Number. Please try Again.')
configselect(int(input("Are you configuring a (1)962, (2)Audience, or (3)mAP? ")))
int()cannot convert letters or symbols the integertry ... exceptis?