Answer the question
In order to leave comments, you need to log in
Local variable 'pes' referenced before assignment error, how to fix?
Traceback (most recent call last):
File "reader.py", line 34, in <module>
log()
File "reader.py", line 15, in log
if pes == True:
UnboundLocalError: local variable 'pes' referenced before assignment
names = '../names.txt'
passwords = '../passwords.txt'
namee = False
pes = True
def log():
name = input('Введите логин: ')
passs = input('Введите пароль: ')
for num, line in enumerate(namesr, 1):
if name == line:
namee = True
for num, line in enumerate(passwordsr, 1):
if passs == line:
pes = True
if pes == True:
if namee == True:
print('Login succesful!!')
def reg():
myname = input('Введите ваше имя (Eng): ')
mypass = input('Введите вашь пароль (Eng): ')
if(myname == mypass):
print("Использование пароля вашем логином запрещено!!!")
reload()
namesr.write(myname)
passwordsr.write(mypass)
print("Аккаунт Зарегистрирован, вход.....")
log()
def reload():
reg()
namesr = open(names, mode='r+', encoding='utf-8')
passwordsr = open(passwords, mode='r+', encoding='utf-8')
reglog = input('Hello, ты Зарегистрирован? (Y/N) : ')
if reglog == "Y":
log()
elif reglog == "N":
reg()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question