Advertisement
Guest User

Untitled

a guest
Sep 20th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. num_count =None
  2. account=0
  3. True_False=False
  4. all_accounts=[
  5. {
  6. "username":"viktor",
  7. "password":"123123",
  8. "date of bird":"02.10.2020",
  9. "male or female":"male",
  10. "country":"Bulgaria",
  11. "interests":[["obicham zelenchuci"]],
  12. "messege":""
  13. }
  14. ]
  15.  
  16. def register(all_accounts):
  17. new_account={}
  18. user_name = input("username :")
  19. password =input("password :")
  20. date_of_birth = input("date of birth :")
  21. male_or_female = input("male or female :")
  22. country=input("country :")
  23. interests=input("interests :")
  24. new_account={
  25. "username" : user_name ,
  26. "password" : password ,
  27. "date of bird" : date_of_birth,
  28. "male or female" : male_or_female,
  29. "country":country,
  30. "interests":interests,
  31. "messege":none
  32. }
  33. all_accounts.append(new_account)
  34.  
  35.  
  36. def log_in(all_accounts,True_False,account):
  37. num_count=0
  38. username=input("username ? ")
  39. password=input("password ? ")
  40. for users in all_accounts:
  41. if username == all_accounts[num_count]["username"] and password == all_accounts[num_count]["password"]:
  42. True_False=True
  43. num_count+=1
  44. while True_False:
  45. answer=input("change or quit ? ")
  46. logged_in(all_accounts,account,answer)
  47. if answer =="quit":
  48. break
  49. account = num_count-1
  50.  
  51. if True_False==False:
  52. print("invailid password or username !!")
  53.  
  54.  
  55.  
  56. def logged_in(all_accounts,account,answer):
  57. if answer == "change":
  58. answer_2 = input("what you need to change ? ")
  59. if answer_2=="password":
  60. curr_password=input("currect password :")
  61. conf_curr_password=input("confirmet currect password :")
  62. if curr_password == all_accounts[num_count-1]["password"] and conf_curr_password == all_accounts[num_count-1]["password"]:
  63. new_password=input("New password :")
  64. all_accounts[account]["password"]=new_password
  65. if answer_2 =="interests":
  66. change_interests(all_accounts,account)
  67.  
  68.  
  69. def change_interests(all_accounts,account):
  70.  
  71. print(all_accounts[0]["interests"])
  72. answer=input("add or remove interests ? ")
  73. if answer == "add":
  74. new_interests=input("New interests :")
  75. all_accounts[account]["interests"].append([new_interests])
  76. if answer == "remove" and len(all_accounts[account]["interests"])==0:
  77. print ("no interest to remove")
  78.  
  79. elif answer == "remove":
  80. remove_interests=int(input("interest which you want to remove "))
  81. all_accounts[account]["interests"].remove(all_accounts[account]["interests"][remove_interests-1])
  82. print(all_accounts[0]["interests"])
  83.  
  84.  
  85.  
  86. while True:
  87. answer = input ("login or register ? ")
  88. if answer == "register":
  89. register(all_accounts)
  90. if answer == "login":
  91. log_in(all_accounts,True_False,account)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement