-
Notifications
You must be signed in to change notification settings - Fork 0
/
2-CityList.py
58 lines (58 loc) · 1.22 KB
/
2-CityList.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding:utf-8 -*-
menu = [{
'北京': {
'海淀': {
'五道口': {
'soho': {},
'网易': {},
'google': {}
},
'中关村': {
'爱奇艺': {},
'汽车之家': {},
'youku': {},
},
'上地': {
'百度': {},
},
},
'昌平': {
'沙河': {
'老男孩': {},
'北航': {},
},
'天通苑': {},
'回龙观': {},
},
'朝阳': {},
'东城': {},
},
'上海': {
'闵行': {
"人民广场": {
'炸鸡店': {}
}
},
'闸北': {
'火车站': {
'携程': {}
}
},
'浦东': {},
},
'山东': {},
}]
while True:
if len(menu) == 0:
exit()
for item in menu[-1]:
print(item)
s = input('>>>')
if s == 'q':
exit('再见')
elif s in menu[-1]:
menu.append(menu[-1][s])
elif s == 'b':
menu.pop()
else:
print('Sorry, invalid input. Please try again')