while flag:
x = input("Input name or press \'q\' to quit:\n")
x = x.lower()
for char in x:
if char.isdigit():
print("Your name cannot be a number. Please type your name again:\n")
continue
if x == "q":
flag = False
elif x == "abe":
print("Welcome back, Abe")
flag = False
else:
i = 4
i-= 1
while i > 0:
print(f"Incorrect name. Please try again. You have {i} tries remaining.\n")
i-= 1
break
if i == 0:
print("You have run out of tries. System is locked.")
break
This is something I was playing around with after I first started learning python a couple days ago. I understand why the number isn't changing but I can't think of a way to make the number different each time it asks for input. Also, if the user inputs a sequence of numbers and letters, the error messages repeat for each number in the input. How would I write it so that as soon as a number is detected, one error message is sent and the loop is restarted?