标签:span col 习题 选择 exit inf 城市 ali family
info = {
"宁夏": {
"银川":{ "兴庆区":{"东方红","西方白"},
"老城区":{"北方绿","南方黑"},
"石油城":{"燕和园","燕翔园"},
},
"吴中":{ "111":{"东方红","西方白"},
"222":{"北方绿","南方黑"},
"333":{"燕和园","燕翔园"},
},
},
"陕西":{
"西安":{ "222":{"东方红","西方白"},
"333":{"北方绿","南方黑"},
"444":{"燕和园","燕翔园"},
},
"咸阳":{ "111":{"东方红","西方白"},
"222":{"北方绿","南方黑"},
"333":{"燕和园","燕翔园"},
},
},
"山东":{
"济南":{ "222":{"东方红","西方白"},
"333":{"北方绿","南方黑"},
"444":{"燕和园","燕翔园"},
},
"潍坊":{ "111":{"东方红","西方白"},
"222":{"北方绿","南方黑"},
"333":{"燕和园","燕翔园"},
},
},
}
exit_falg = 1
while exit_falg:
for i in info:
print(‘\t‘,i)
choise1 = input("请输入要选择的省份,按q退出程序:")
if choise1 == ‘q‘:
exit_falg = 0
if choise1 in info:
while exit_falg:
for j in info[choise1]:
print(‘\t\t‘,j)
choise2 = input("请输入要选择的城市,按q退出程序,按b退回到上一级:")
if choise2 == ‘q‘:
exit_falg = 0
if choise2 == ‘b‘:
break
if choise2 in info[choise1]:
while exit_falg:
for k in info[choise1][choise2]:
print(‘\t\t\t‘,k)
choise3 = input("请输入要选择的区,按q退出程序,按b退回到上一级:")
if choise3 == ‘q‘:
exit_falg = 0
if choise3 == ‘b‘:
break
if choise3 in info[choise1][choise2]:
for i3 in info[choise1][choise2][choise3]:
print(‘\t\t\t\t‘, i3)
choise4 = input("最后一层,按b返回,按q退出:")
if choise4 == ‘q‘:
exit_falg = 0
if choise4 == ‘b‘:
break
习题-三级目录
标签:span col 习题 选择 exit inf 城市 ali family
原文地址:https://www.cnblogs.com/nickkkk/p/8940708.html