Login and create username and password program I'm trying to make a password program that you can login to or make a new user.
I want to make this better, so any help would be appreciated, also any suggestions to make this better would be good

import time  
LOGIN = ("Login", "login", "L", "l", "LOGIN")  
CREATE = ("Create", "create", "C", "c", "CREATE", "Create Account", "Create account", "create Account", "create account", "CREATE ACCOUNT")   
x = 0  
newPass = "X"  
newUser = "X"  

validEntry = {  
    "Liam" : "liampass",  
    "Bob" : "bobpass"  
}  #All current usernames and passwords stored in this dictionary

print("--==Welcome==--")  
time.sleep(1)  
def choice():  
    print("Login or Create Account?")  
    choice = input(":&gt;&gt;&gt;")  
    if choice in LOGIN:  
        login()  
    elif choice in CREATE:  
        create()           #Choice to login or create

def login():  
    print("""  
Please login. Case sensitive.""")  
    time.sleep(0.5)  
    print("Username.")  
    entry = input(":&gt;&gt;&gt;")  
    if entry in validEntry:  
        x = 0  
        while x &lt; 3:  
            print("Input Password.")  
            passentry = input(":&gt;&gt;&gt;")  
            passright = validEntry.get(entry)  #Checks dictionary to find password associated with username entered
            if passentry == passright:  
                print("Successful Login!")     
                x += 5  #Correct password, addition code could be added here
            else:  
                print("""Incorrect password, try again  
                      """)  
                x += 1     #Incorrect password, allows three attempts 
    else:  
        print("Username not recognised!")  
        login()  

def create():  
    print("Please choose a username")  
    newUser = str(input(":&gt;&gt;&gt;"))  
    print("Please choose a password for", newUser)  
    newPass = str(input(":&gt;&gt;&gt;"))  
    global newUser, newPass  #Globalizes both new password and username for entry to dictionary 

choice()  

validEntry[newUser] = newPass #Adds new username and password to dictionary  

choice()  #You can only make one new account then login
I have some suggestions, some regarding the code and some regarding the logic of it. Generally this is a nice code.
Let's begin, logical suggestions:


First of all, the code does not run. SyntaxError: name 'newUser' is used prior to global declaration. You should put the global keyword before declaring the variables.
Use the __main__ function. Usually when writing a good python code you do not write logic outside of functions. This will make your code more readable. You can than put the logic in a while True loop and keep accept users forever and not just twice.


Coding suggestions:


Magic numbers. The number of time you can accept a wrong password is 3, make it a constant: NUMBER_OF_ERROR = 3.
You do not need to declare x outside of the login function.
Instead of x += 5 just use break, it makes much more sense.
Do not call the login function at the end of login. It creates unnecessary recursion.


That's it.
Good luck and have fun