I am trying to learn python and I created some lines of codes, and in theses lines, I created a system of login. So I created a system of logout too. BUT, when I tried to put the name's variable into another to register it, an error was displayed as : UnboundLocalError: local variable 'name' referenced before assignment So I checked this website and it tell me to put the variable in global, and when I tried, another error was displayed as : SyntaxError: name 'name' is used prior to global declaration Can somebody here help me?
def menu():
menu=input("type 1 to logout and login after : ")
if menu="1":
print("")
print("You're now logout.")
print("")
menu=int(menu)
log_name=name
log_password=password
name_inscription_confirm=0
password_inscription_confirm=0
print("")
print("Hello,")
print("")
name_inscription=input("What's your name?")
while name_inscription_confirm==0:
print("")
name_inscription=input("What's your name?")
if name_inscription==log_name:
name_inscription_confirm=1
password_inscription=input("What's your password?")
if password_inscription==log_password:
print("Welcome back '{}'!".format(log_name))
password_inscription_confirm=1
else:
print("")
print("incorrect password")
password_inscription_confirm=0
else:
print("incorrect username")
name_inscription_confirm=0
continue
pass
pass
And then:
name=input("Choose your name : ")
print("")
password=input("Choose your password : ")