1 usr = {
2 'zhang xu':{
3 "telephon_num":12345678986,
4 "addr":"san dun",
5 "sex":'woman',
6 "marital status":"no",
7 },
8
9 'gu er cheng':{
10 "telephon_num":1367852374,
11 "addr":"da qiao",
12 "sex":'gay',
13 "marital status":"yes",
14 },
15 }
16 print ("\n======================Welcome to information system==============================================")
17 active=True
18 active1=True
19 active2=True
20 while True and active:
21 prompt = "\nWelcome to system!"
22 prompt +="\nHere is the main menu, type the number bellow to choose:"
23 menu = "\n1:Search the member information."
24 menu += "\n2:Show all member's information inside the system."
25 menu += "\n3:Add new member's information."
26 menu += "\n4:Delete member's information."
27 print (menu)
28 choose_num = input(prompt)
29 finally_input = ''
30 while choose_num == '1' and active1:
31 while finally_input !='quit':
32 print("Welcome to search interface!")
33 name_input = input("Please input the name what you want to search for:")
34 for name,info in usr.items():
35 if name_input == name:
36 print ("\nHere is your information:")
37 print("name: ",name.title())
38 telephon_num = info["telephon_num"]
39 addr = info["addr"]
40 sex = info["sex"]
41 marital = info["marital status"]
42
43 print ("Telephon number:",telephon_num)
44 print ("Home address:",addr)
45 print ("sex:",sex)
46 print ("Have married or not:",marital)
47 break
48 else:
49 continue
50 finally_input = input("Type 'quit' to out of this system or continue to search:")
51 break
52 while choose_num == '2' and active2==True:
53 for i in range(4):
54 passwd = input("Please input the password for futher operation:")
55 if i==3:
56 print ("Sorry,you can't do futher operation!")
57 active2=False
58 if passwd != "123456":
59 print ("Try again!")
60 continue
61 else:
62 break
63
64 for name,info in usr.items():
65 print ("\nHere is all member's infortion!")
66 print("name: ",name.title())
67 telephon_num = info["telephon_num"]
68 addr = info["addr"]
69 sex = info["sex"]
70 marital = info["marital status"]
71
72 print ("Telephon number:",telephon_num)
73 print ("Home address:",addr)
74 print ("sex:",sex)
75 print ("Have married or not:",marital)
76 finally_input = input("Type 'quit' to out of this system or continue to other operation:")
77 if finally_input == 'quit':
78 active2=False
79 q = input("Input q to quit all!")
80 if q =='q':
81 print("========================================Thank for your use=============================================")
82 active = False
python 第七天:尝试写一个待完善的通信录系统
猜你喜欢
转载自blog.csdn.net/CalvinHARRIS/article/details/82808352
今日推荐
周排行