usr = {
'zhang xu':{
"telephon_num":12345678986,
"addr":"san dun",
"sex":'woman',
"marital status":"no",
},
'gu er cheng':{
"telephon_num":1367852374,
"addr":"da qiao",
"sex":'gay',
"marital status":"yes",
},
}
print ("\n======================Welcome to information system==============================================")
active=True
Pass=False
show=False
agin=False
pass1=False
agin1=False
Pass2=False
while True and active:
print ("\nWelcome to the address book system 1.0.0!")
print("*********************************MENU*********************************************************")
menu = "1:Search the member information."
menu += "\n2:Show all member's information inside the system."
menu += "\n3:Add new member's information."
menu += "\n4:Delete member's information."
print (menu)
prompt = "\nType the number bellow to choose:"
print("**********************************MENU*******************************************************")
choose_num = input(prompt)
finally_input = ''
while choose_num == '1' and act1:
while finally_input !='quit':
print("Welcome to search interface!")
name_input = input("Please input the name what you want to search for:")
all_member_name=[]
for name in usr.keys():
all_member_name.append(name)
while name_input in all_member_name:
for name,info in usr.items():
if name_input == name:
print ("\nHere is your information:")
print("name: ",name.title())
telephon_num = info["telephon_num"]
addr = info["addr"]
sex = info["sex"]
marital = info["marital status"]
print ("Telephon number:",telephon_num)
print ("Home address:",addr)
print ("sex:",sex)
print ("Have married or not:",marital)
break
else:
continue
break
if name_input not in all_member_name:
print("Sorry, the person: "+name_input.title()+" isn't in our system. Please check it agin!")
finally_input = input("Type 'quit' to out of this interface or continue to search:")
break
while choose_num == '2':
for i in range(4):
passwd = input("Please input the password for futher operation:")
if passwd != "123456":
print ("Try again!")
else:
Pass = True
break
if i==3:
print ("Sorry,you can't do futher operation!")
break
else:
continue
while Pass or show:
print ("\nHere is all member's infortion!\n")
for name,info in usr.items():
print("name: ",name.title())
telephon_num = info["telephon_num"]
addr = info["addr"]
sex = info["sex"]
marital = info["marital status"]
print ("Telephon number:",telephon_num)
print ("Home address:",addr)
print ("sex:",sex)
print ("Have married or not:",marital)
print("\n")
finally_input = input("Type 'quit' to out of this interface or show that agin:")
if finally_input == 'quit':
break
else:
show = True
break
while choose_num == '3':
for i in range(4):
passwd = input("Please input the password for futher operation:")
if passwd != "123456":
print ("Sorry,try again!")
else:
Pass1 = True
break
if i==3:
print ("Sorry,you can't do futher operation!")
break
else:
continue
while Pass1 or agin:
name_add = input("What's the name:")
telephom_num_add = input("What's telephon number:")
sex_add=input("What sex:")
address_add=input("What's the address:")
marial_add=input("Marital status(yes/no):")
usr.update({name_add:{'telephon_num':telephom_num_add,'addr':address_add,'sex':sex_add,'marital status':marial_add}})
ifshow = input("Do you want to check the information?(y/n)")
if ifshow == 'y':
for name,info in usr.items():
if name_add == name:
print ("\nHere is your information:")
print("name: ",name.title())
telephon_num = info["telephon_num"]
addr = info["addr"]
sex = info["sex"]
marital = info["marital status"]
print ("Telephon number:",telephon_num)
print ("Home address:",addr)
print ("sex:",sex)
print ("Have married or not:",marital)
break
else:
continue
if ifshow == 'n':
print("The information has already in the system!")
break
finally_input = input("Type 'quit' to out of this interface or continue to add information:")
if finally_input == 'quit':
break
else:
agin = True
while choose_num == '4':
for i in range(4):
passwd = input("Please input the password for futher operation:")
if passwd != "654321":
print ("Sorry,try again!")
else:
Pass2 = True
break
if i==3:
print ("Sorry,you can't do futher operation!")
break
else:
continue
while Pass2 or agin1:
all_member_name=[]
for name in usr.keys():
all_member_name.append(name)
name_del=input("Type the name you want to delete:")
if name_del not in all_member_name:
print("Sorry, the person: "+name_del.title()+" isn't in our system. Please check it agin!")
break
if name_del in all_member_name:
agree_confirm = input ("Are you sure to delete the information about "+name_del.title()+"?y/n\n")
if agree_confirm == 'y':
usr.pop(name_del)
print("The information has already deleted!")
break
if agree_confirm == 'n':
break
finally_input = input("Type 'quit' to out of this interface or continue to delete information:")
if finally_input == 'quit':
break
else:
agin1 = True
q = input("Input q to quit all! Or do more operation.")
if q =='q':
print("========================================Thank for your use=============================================")
active = False