Complete-Python-3-Bootcamp
Complete-Python-3-Bootcamp copied to clipboard
62. Validating User input (Shortcut)
def user_choice(): valid_range = range(0,11) choice = 'ABCDE'
while choice.isdigit() == False or int(choice) not in valid_range:
choice = (input('Please select a Number (1-10) :\n'))
print(f"Let's Try, Select only from (1-10) : {choice}")
return(int(choice))