_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