Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num_count =None
- account=0
- True_False=False
- all_accounts=[
- {
- "username":"viktor",
- "password":"123123",
- "date of bird":"02.10.2020",
- "male or female":"male",
- "country":"Bulgaria",
- "interests":[["obicham zelenchuci"]],
- "messege":["meh","stava"],
- "send by":[["viktor"],["viktor02"]],
- },
- {
- "username":"viki",
- "password":"12312",
- "date of bird":"02.10.2020",
- "male or female":"male",
- "country":"Bulgaria",
- "interests":[["obicham zelenchuci"]],
- "messege":["meh","stava"],
- "send by":[["viktor"],["viktor02"]],
- }
- ]
- def register(all_accounts):
- new_account={}
- user_name = input("username :")
- password =input("password :")
- date_of_birth = input("date of birth :")
- male_or_female = input("male or female :")
- country=input("country :")
- interests=input("interests :")
- new_account={
- "username" : user_name ,
- "password" : password ,
- "date of bird" : date_of_birth,
- "male or female" : male_or_female,
- "country":country,
- "interests":interests,
- "messege":None,
- "send by":None
- }
- all_accounts.append(new_account)
- def log_in(all_accounts,True_False,account):
- num_count=-1
- username=input("username ? ")
- password=input("password ? ")
- for users in range(len(all_accounts)):
- num_count+=1
- if username == all_accounts[num_count]["username"] and password == all_accounts[num_count]["password"]:
- True_False=True
- while True_False:
- answer=input("change , quit , message or search ? ")
- logged_in(all_accounts,account,answer)
- if answer =="quit":
- break
- account = num_count-1
- if True_False==False:
- print("invailid password or username !!")
- def logged_in(all_accounts,account,answer):
- if answer == "search" :
- print("!")
- if answer == "message":
- messages(all_accounts,account,answer)
- if answer=="change":
- change_account(all_accounts,account,answer)
- def messages(all_accounts,account,answer):
- question = input("see messages or send a message ")
- if question == "see messages":
- curr_user=0
- curr_mess=0
- for row in range(len(all_accounts[account]["send by"])):
- print(all_accounts[account]["send by"][curr_user],":",all_accounts[account]["messege"][curr_mess])
- curr_user+=1
- curr_mess+=1
- if question =="send message":
- user=0
- for row in range(len(all_accounts)):
- if all_accounts[user]["username"] == all_accounts[account]["username"]:
- user+=1
- else:
- print(all_accounts[user]["username"])
- user+=1
- chose_user=input("Which do you want to send a message ")
- send_message = 0
- for row in range(len(all_accounts)):
- if chose_user==all_accounts[send_message]["username"]:
- message_send=input("message:")
- all_accounts[send_message]["messege"].append([message_send])
- all_accounts[send_message]["send by"].append([all_accounts[account]["username"]])
- send_message+=1
- else:
- print("there is no such user")
- def change_account(all_accounts,account,answer):
- answer_2 = input("what you need to change ? ")
- if answer_2=="password":
- curr_password=input("currect password :")
- conf_curr_password=input("confirmet currect password :")
- if curr_password == all_accounts[account]["password"] and conf_curr_password == all_accounts[account]["password"]:
- new_password=input("New password :")
- all_accounts[account]["password"]=new_password
- elif answer_2 =="interests":
- change_interests(all_accounts,account)
- elif answer_2 =="country":
- new_country=input("New country :")
- all_accounts[account]["country"]=new_country
- elif answer_2 =="male or female":
- new_male_or_female=input("male or female")
- all_accounts[account]["male or female"]
- else:
- print("ERROR : invalid text ")
- def change_interests(all_accounts,account):
- print(all_accounts[account]["interests"])
- answer=input("add or remove interests ? ")
- if answer == "add":
- new_interests=input("New interests :")
- count_1=0
- for row in range(len(all_accounts[account]["interests"])):
- if new_interests == all_accounts[account]["interests"][count_1]:
- print("this interest already have it")
- break
- count_1+=1
- else:
- all_accounts[account]["interests"].append([new_interests])
- if answer == "remove" and len(all_accounts[account]["interests"])==0:
- print ("no interest to remove")
- elif answer == "remove":
- remove_interests=int(input("interest which you want to remove "))
- all_accounts[account]["interests"].remove(all_accounts[account]["interests"][remove_interests-1])
- print(all_accounts[0]["interests"])
- while True:
- answer = input ("login or register ? ")
- if answer == "register":
- register(all_accounts)
- if answer == "login":
- log_in(all_accounts,True_False,account)
- else:
- print("ERROR : invalid text ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement