daily pastebin goal
92%
SHARE
TWEET

Untitled

a guest Sep 25th, 2016 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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":["meh","stava"],
  13.         "send by":[["viktor"],["viktor02"]],
  14.         },
  15.         {
  16.         "username":"viki",
  17.         "password":"12312",
  18.         "date of bird":"02.10.2020",
  19.         "male or female":"male",
  20.         "country":"Bulgaria",
  21.         "interests":[["obicham zelenchuci"]],
  22.         "messege":["meh","stava"],
  23.         "send by":[["viktor"],["viktor02"]],
  24.         }
  25.    
  26.     ]
  27.  
  28. def register(all_accounts):
  29.     new_account={}
  30.     user_name = input("username :")
  31.     password =input("password :")
  32.     date_of_birth = input("date of birth :")
  33.     male_or_female = input("male or female :")
  34.     country=input("country :")
  35.     interests=input("interests :")
  36.     new_account={
  37.         "username" : user_name ,
  38.         "password" : password ,
  39.         "date of bird" : date_of_birth,
  40.         "male or female" : male_or_female,
  41.         "country":country,
  42.         "interests":interests,
  43.         "messege":None,
  44.         "send by":None
  45.          }
  46.     all_accounts.append(new_account)
  47.    
  48.    
  49. def log_in(all_accounts,True_False,account):
  50.     num_count=-1
  51.     username=input("username ? ")
  52.     password=input("password ? ")
  53.     for users in range(len(all_accounts)):
  54.         num_count+=1
  55.         if username == all_accounts[num_count]["username"] and password == all_accounts[num_count]["password"]:
  56.             True_False=True
  57.             while  True_False:
  58.                 answer=input("change , quit , message or search ? ")
  59.                 logged_in(all_accounts,account,answer)
  60.                 if answer =="quit":
  61.                     break
  62.        
  63.        
  64.     account = num_count-1
  65.            
  66.     if True_False==False:
  67.         print("invailid password or username !!")
  68.        
  69.  
  70.  
  71.  
  72. def logged_in(all_accounts,account,answer):
  73.    
  74.     if answer == "search" :
  75.         print("!")
  76.        
  77.     if answer == "message":
  78.         messages(all_accounts,account,answer)
  79.        
  80.     if answer=="change":
  81.         change_account(all_accounts,account,answer)
  82.        
  83.  
  84. def messages(all_accounts,account,answer):
  85.     question = input("see messages or send a message ")
  86.     if question == "see messages":
  87.         curr_user=0
  88.         curr_mess=0
  89.         for row in range(len(all_accounts[account]["send by"])):
  90.             print(all_accounts[account]["send by"][curr_user],":",all_accounts[account]["messege"][curr_mess])
  91.             curr_user+=1
  92.             curr_mess+=1
  93.     if question =="send message":
  94.         user=0
  95.         for row in range(len(all_accounts)):
  96.             if all_accounts[user]["username"] == all_accounts[account]["username"]:
  97.                 user+=1
  98.             else:
  99.                 print(all_accounts[user]["username"])
  100.                 user+=1
  101.         chose_user=input("Which do you want to send a message ")
  102.         send_message = 0
  103.         for row in range(len(all_accounts)):
  104.             if chose_user==all_accounts[send_message]["username"]:
  105.                 message_send=input("message:")
  106.                 all_accounts[send_message]["messege"].append([message_send])
  107.                 all_accounts[send_message]["send by"].append([all_accounts[account]["username"]])
  108.             send_message+=1
  109.         else:
  110.             print("there is no such user")
  111.    
  112.            
  113. def change_account(all_accounts,account,answer):
  114.    
  115.     answer_2 = input("what you need to change ? ")
  116.     if answer_2=="password":
  117.         curr_password=input("currect password :")
  118.         conf_curr_password=input("confirmet currect password :")
  119.         if curr_password == all_accounts[account]["password"] and conf_curr_password == all_accounts[account]["password"]:
  120.             new_password=input("New password :")
  121.             all_accounts[account]["password"]=new_password
  122.     elif answer_2 =="interests":
  123.         change_interests(all_accounts,account)
  124.     elif answer_2 =="country":
  125.         new_country=input("New country :")
  126.         all_accounts[account]["country"]=new_country
  127.     elif answer_2 =="male or female":
  128.         new_male_or_female=input("male or female")
  129.         all_accounts[account]["male or female"]
  130.     else:
  131.         print("ERROR : invalid text ")
  132.    
  133.    
  134. def change_interests(all_accounts,account):
  135.    
  136.     print(all_accounts[account]["interests"])
  137.     answer=input("add or remove interests ? ")
  138.     if answer == "add":
  139.         new_interests=input("New interests :")
  140.         count_1=0
  141.         for row in range(len(all_accounts[account]["interests"])):
  142.             if new_interests == all_accounts[account]["interests"][count_1]:
  143.                 print("this interest already have it")
  144.                 break
  145.             count_1+=1
  146.         else:
  147.             all_accounts[account]["interests"].append([new_interests])
  148.     if answer == "remove" and len(all_accounts[account]["interests"])==0:
  149.         print ("no interest to remove")
  150.        
  151.     elif answer == "remove":
  152.         remove_interests=int(input("interest which you want to remove "))
  153.         all_accounts[account]["interests"].remove(all_accounts[account]["interests"][remove_interests-1])
  154.         print(all_accounts[0]["interests"])
  155.    
  156.  
  157.        
  158. while True:
  159.     answer = input ("login or register ? ")
  160.     if answer == "register":
  161.         register(all_accounts)
  162.     if answer == "login":
  163.         log_in(all_accounts,True_False,account)
  164.     else:
  165.         print("ERROR : invalid text ")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand