第一章--三级菜单作业

时间:2021-04-30 21:56:24
#_*_coding:utf-8_*_
menu = {
'北京':{
'海淀':{
'五道口':{
'soho':{},
'网易':{},
'google':{}
},
'中关村':{
'爱奇艺':{},
'汽车之家':{},
'youku':{}
},
'上地':{
'百度':{},

},

},
'昌平':{
'沙河':{
'老男孩':{},
'北航':{},
},

},
'天通苑':{},
'回龙观':{},

},
'上海':{
'闵行':{},
'闸北':{
'火车站':{
'携程':{},

},
}
},
'浦东':{},
},


while True:
for k in menu:
print(k)
choice = input(">:").strip
if not choice:continue
if choice in menu:
while True:
for k in menu[choice]:
print(k)
choice2=input(">>:").strip()
if not choice2: continue
if choice2 in menu[choice]:
while True:

for k in menu[choice][choice2]:
print(k)
choice3 = input(">>>:").strip()
if not choice3:continue
if choice3 in menu[choice][choice2]:
print("go to ,",menu[choice] [choice2] [choice3])
else:
print("节点不存在")


else:
print("节点不存在")