首页 > 其他 > 详细

My first program and first blogs-三级菜单

时间:2018-09-08 00:11:53      阅读:248      评论:0      收藏:0      [点我收藏+]
_author Administrator
#date 2018/9/7
items = {
‘陕西‘:{
‘西安‘:[‘周至‘,‘户县‘,‘蓝田‘ ],
‘宝鸡‘:[‘蔡家坡‘,‘陈仓‘,‘凤县‘]
},
‘山东‘:{
‘烟台‘:[‘栖霞‘,‘枣庄‘,‘c‘],
‘青岛‘:[‘a‘,‘b‘,‘d‘]
}
}
print(items)
a = ‘陕西‘
b = ‘山东‘
a1 = ‘宝鸡‘
a2 = ‘西安‘
flag = True
while flag:
choice1 = input(‘please input you decide1 [陕西/山东]:‘)
if choice1 == a:
print(items[a])
while flag:
choice2 = input(‘please input you decide2 [西安/宝鸡]:‘)
if choice2 == a1:
print(items[a][a1])
while flag:
choice3 = int(input(‘please input you number:‘))
if choice3 < 3:
print(items[a][a1][choice3-1])
flag = False
else:
flag = True
elif choice2 == a2:
print(items[a][a2])
while flag:
choice3 = int(input(‘please input you number:‘))
if choice3 < 3:
print(items[a][a2][choice3-1])
flag = False
else:
flag = True
else:
flag = True

My first program and first blogs-三级菜单

原文:https://www.cnblogs.com/harryzhu/p/9607633.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!