[Solved] Make two while loops one loop


From you saying the only difference is 1 becomes 2 I’m guessing you are just trying to run the loop again for a second user, perhaps a dictionary here, then you could just iterate the loop you already have constructed for each user in the dicitonary, you would have to touch up your loops I cannot run them but an idea for format would be something like so

while True:
    users = {'User 1': [username1, password1], 'User 2': [username2, password2]}
    for k in users:
        print('{}'.format(k))
        login=input("Do you have an account? (yes/no) ")
        loggedin=False
        if login.lower()=="yes":
            login1=open("login.csv")
            reader = csv.reader(login1)
            users[k][0]=input("What is your username: ")
            users[k][1]=input("What is your password: ")
            for row in reader:
                if row[0]==users[k][0]:
                    if row[1]==users[k][1]:
                        print("Welcome " + users[k][0])
                        loggedin=True
                        break
            if loggedin==False:
                print("Invalid username or password. Please try again.")
                continue

        elif login.lower()=="no":
            print(" ")
            print("Make an account.")
            print(" ")
            users[k][0]=input("What is your username: ")
            users[k][1]=input("What is your password: ")
            break

        else:
            print("Invalid input.")
            continue

solved Make two while loops one loop