So i'm trying to ask for an input and then validate if the password is correct. It will check if the input is blank, incorrect or correct. However, after the first initial blank input, if I enter a blank again the program breaks. How do I make it keep looping and validating correctly
def getUserName():
userName = ["Chan"]
userNameInput = [""]
userNameInput[0] = input("Username: ")
while userNameInput != userName:
if userNameInput[0] == "":
print("Username can not be blank. Please try again.")
userNameInput = input("Username: ")
elif userNameInput[0] == userName[0]:
print("Username is correct. Input password.")
else:
print("Username is not correct. Please try again.")
userNameInput = input("Username: ")