Advertisement
Guest User

Untitled

a guest
May 4th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. def user_input(x,un,pw):
  2. if (x==0):
  3. print("password incorrect ")
  4. changepw(un)
  5. user_input(3,un,pw)
  6. else:
  7. if d[un]==pw:
  8. print("correct password:"+pw)
  9. display_menu()
  10. else:
  11. pw=input('invalid password, enter password again : ')
  12. user_input(x-1,un,pw)
  13.  
  14. def changepw(un):
  15. npw=(input('Invalid password- enter new password to update account : '))
  16. d[un]=npw
  17.  
  18. def update_database():
  19. file = open("password.txt","w")
  20. Lst=()
  21. d.values()=lst
  22. file.close()
  23.  
  24. def checkun(un):
  25. if un in d:
  26. return True
  27. else:
  28. return False
  29.  
  30.  
  31. def display_menu():
  32. print("MAIN MENU : ")
  33. print('A.Investment Projection')
  34. print('B.Rettirement Planning')
  35. print('C.Mortgage')
  36. print('D.College Fund')
  37. print('E.Exit')
  38.  
  39. def main():
  40. with open("user.txt") as f:
  41. A = [str(x) for x in f.read().split()]
  42.  
  43. with open("password.txt") as j:
  44. B = [str(x) for x in j.read().split()]
  45.  
  46.  
  47. lenA=len(A)
  48. for i in range(lenA):
  49. d[A[i]]=B[i]
  50. print(d)
  51.  
  52. un=input('enter your username:')
  53. pw=input('enter your password:')
  54. while(not(checkun(un))):
  55. un=input('enter your username:')
  56. pw=input('enter your password:')
  57. user_input(3,un,pw)
  58.  
  59. d={}
  60. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement