So I am making this program where I let the user login in and I check their details(which are stored in an external file) and if they are wrong then I want the program to make them enter their details again. However with this code even if I enter the correct details it still says incorrect and loops. The code:
login_username = input("Enter your username: ")
login_password = input("Enter your password: ")
file_2 = open("data.txt","r")
for line in file_2:
info = line.split(",")
if login_username == info[0] and login_password == info[1]:
quiz()
while login_username != info[0] and login_password != info[1]:
print("Error")
login_username = input("Enter your username: ")
login_password = input("Enter your password: ")
Any clue?