码迷,mamicode.com
首页 > 其他好文 > 详细

My first program and first blogs-三级菜单

时间:2018-09-08 00:43:52      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:dmi   log   while   tor   陕西   number   first   ice   ems   

_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-三级菜单

标签:dmi   log   while   tor   陕西   number   first   ice   ems   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!