Well, I'm a relative beginner in Python and I wanted to make a simple login function, but I ran into a problem.
def login():
    loginTries = 0
    loginName = str(input("\nPlease enter your username: "))
    loginPassword = str(input("Please enter your password: "))
    if loginName not in loginNames or loginPassword != realLoginPassword:
        print("\nOops! You typed something wrong. Try again!")
        loginTries += 1
    
    while loginTries < 4:
        login()
    else:
        register()
    return
I had planned to redirect to another (register) function after three unsuccessful attempts, but the problem is that I can't count how many times the function has been repeated, because the values entered are reset each time it is repeated. I pictured it as shown above, but as I wrote before, it does not save the value.
 
     
    