Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def user_input(x,un,pw):
- if (x==0):
- print("password incorrect ")
- changepw(un)
- user_input(3,un,pw)
- else:
- if d[un]==pw:
- print("correct password:"+pw)
- display_menu()
- else:
- pw=input('invalid password, enter password again : ')
- user_input(x-1,un,pw)
- def changepw(un):
- npw=(input('Invalid password- enter new password to update account : '))
- d[un]=npw
- update_database()
- def checkun(un):
- if un in d:
- return True
- else:
- return False
- def update_database():
- file = open(βpassword.txtβ,βwβ)
- file.write(d.values())
- def display_menu():
- print("MAIN MENU : ")
- print('A.Investment Projection')
- print('B.Rettirement Planning')
- print('C.Mortgage')
- print('D.College Fund')
- print('E.Exit')
- def main():
- with open("user.txt") as f:
- A = [str(x) for x in f.read().split()]
- with open("password.txt") as j:
- B = [str(x) for x in j.read().split()]
- lenA=len(A)
- for i in range(lenA):
- d[A[i]]=B[i]
- print(d)
- un=input('enter your username:')
- pw=input('enter your password:')
- while(not(checkun(un))):
- print("username does not exist")
- un=input('enter your username:')
- pw=input('enter your password:')
- user_input(3,un,pw)
- d={}
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement