while True:
first_name = input('Please enter your first name:\n')
last_name = input('Please enter your last name:\n')
try:
firstn = str(first_name)
lastn = str(last_name)
except ValueError:
print('did not enter str')
continue
else:
return firstn
return lastn
I'm trying to use exception handling with my code. I want to check whether or not the user has inputed the correct string value for first and last name. users cannot input numbers for their first and last names. my code seems to ignore the Value error if I use numbers for usernames.