1.1.1多级菜单练习--Python(Alex视频学习)201806011

多级菜单

     1、三级菜单

     2、可一次选择进入各子菜单

     3、所需新知识点:列表、字典




data={
"北京":{
"昌平":{
"沙河":["shahe","chengshi"],
"天通苑":["tiantong","yuan"]
},
"朝阳":{
"奇葩说":["qipa","dahui"],
"国贸":["guomap","hp"]
}
},
"浙江":{
"浦江":["九华山","金狮湖"],
"义乌":["异国风情街","小商品市场"],
},
"上海":{
"浦东":["陆家嘴","金桥"],
"闵行":["虹桥","天街"],
"奉贤":["油菜花","海边"],
}
}

while True:
for i in data:
print(i)
choice1 = input("input you choice1:")
if choice1 in data:
for i2 in data[choice1]:
print(i2)
choice2 = input("input you choice2:")
if choice2 in data[choice1]:
for i3 in data[choice1][choice2]:
print(i3)
choice3=input("press b comeback,q exit")
if choice3=="q":
exit()
elif choice3=="b":
break
else:
print("conform your input")
if choice2=="b":
break



猜你喜欢

转载自www.cnblogs.com/pei-jennifer/p/9169450.html
今日推荐