python - How do I provide error checking to ensure user input only allows letters and provides a looping error message if numbers are typed? -
i trying provide looping error message user customername input user receives error message if type other letters aa - zz,(i don't want allow user input numbers specifically). operate similar 1 used customerage input( provided example). cant seem figure out correct code accomplish this. can provide insight?
customername = input('enter name: ') customerage = int(input('enter age: ')) while customerage <= 15 or customerage >= 106: print('invalid entry') customerage = int(input('enter age: '))
after reviewing answers received (thanks goes out of help). coded , appears operating correctly.
customer_name = input('please enter name: ') while not customer_name.isalpha(): print('invalid entry') customer_name = input('please enter name: ')
Comments
Post a Comment