1. 程式人生 > >My first program and first blogs-三級菜單

My first program and first blogs-三級菜單

logs spa items pan choice dmi als ase rst

_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-三級菜單