Apr-15-2019, 07:08 PM
(This post was last modified: Apr-15-2019, 07:30 PM by ichabod801.)
I want to make it so that if I get the password wrong, and I choose to retry, it will ask me again and go through the same checking process again.
logged_in=False
attempts=0
enter_name=input('ENTER NAME: ')
enter_password=input('ENTER PASSWORD ')
with open('Data.txt', 'r') as file:
for line in file:
name, password = line.split(',')
if name == enter_name:
logged_in = password == enter_password
break
else:
attempts+=1
print('WRONG USERNAME OR PASSWORD')
enter_option=input('ENTER OPTIONS:\n A-RETRY\n')
if logged_in==True:
print('Hello ',name)
