Advertisement
Guest User

Untitled

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