I'm creating a program where it collects data from the user, I have finished the basic inputs of collecting their first name, surname, age etc; however I wanted the user to have no numbers in their first name or surname.
If the user types a number in their first name such as "Aaron1" or their surname as "Cox2"; it would repeat the question asking for their name again.
Attempt 1
firstname=input("Please enter your first name: ")
if firstname==("1"):
firstname=input("Your first name included a number, please re-enter your first name")
else:
pass
Attempt 2
firstname=input("Please enter your first name: ")
try:
str(firstname)
except ValueError:
try:
float(firstname)
except:
firstname=input("Re-enter your first name: ")
Any suggestions?