Answer the question
In order to leave comments, you need to log in
How to write a program that remembers the data entered earlier and uses it?
Briefly speaking. First, I will write the question in more detail, then I will go into "well, in general, how I think this should be done."
Suppose there is a simple if-elif program, which, depending on the entered password, displays some information by type
login = str(input("Введите логин: "))
password = str(input("Введите пароль: "))
if (login == 'TheAmmiR') and (password == 'mysecretpassword'):
print("Рады вас приветствовать, администратор интернет-магазина \"Утюг\".")
elif (login == 'User') and (password == 'none'):
print("Рады вас приветствовать в нашем интернет-магазине!")
else:
print("Неправильно введенный логин или пароль.")
login = str(input("Enter your login: "))..?
password = str(input("Enter your password: "))
Answer the question
In order to leave comments, you need to log in
The easiest way is probably to read from the same text file.with open(file, 'r') as f:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question