Nom d'utilisateur et fonction de connexion du mot de passe

def login():
    attempt = 3
    username = input("Enter your username:\n> ")
    while True:
     if username in userNamePassword:
        password = input("Enter your password:\n> ")
        if userNamePassword[username] == password:
            print("Logged in")
            return True
        elif userNamePassword[username] != password:
            attempt -=1
            print("Sorry, the password is invalid. You have", attempt,"attempts remaining.")  
            login()
            if attempt == 0:
             print("Sorry, you have exhausted your password attempts. Please restart the process.")
             break
Handsome Horse