Hi guys! I was trying to make this small project to understand better how comparison operators works. I have the following problem: I want the program to ask the user’s name, if it has less than 3 characters, program will show an error message, if it has more than 50 characters, it will show another error message.
I want the program to return the user to the first line (as you can see in this image):
BUT I don’t know how to do it. I was trying to find the answer on Saint Google but it was difficult.
Should I used the return function to return the user to the first line until he write a name with more than 3 and less than 50 characters?
name = input('Your name: ')
if len(name) < 3:
print('Name must be at least 3 characters')
elif len(name) > 50:
print('Name must be a maximum of 50 characters')
else:
print('Name looks good!')
#How can I do to make the program returns the user to first line if the name's characters are less than 3 or greater than 50?
Thanks!