NullMoneyException
java.life.NullMoneyException
 1 #Author:shijt
 2 
 3 china_map = {
 4     "河北": {
 5         '石家庄': ['辛集', '正定', '晋州'],
 6         '邯郸': ['涉县', '魏县', '磁县'],
 7         '衡水': ['饶阳', '安平', '深州']
 8     },
 9     "河南": {
10         '郑州': ['巩义', '新郑', '登封'],
11         '开封': ['兰考', '通许', '尉氏'],
12         '洛阳': ['宜阳', '孟津', '新安']
13     },
14     "山西": {
15         '太原': ['清徐', '阳曲', '古交'],
16         '大同': ['左云', '大同', '广灵'],
17         '晋城': ['泽州', '阳城', '泌水']
18     }
19 }
20 exit_flag=False
21 while not exit_flag:
22     for i1 in china_map:
23         print(i1)
24     choice1=input(">>>choice1:")
25     if choice1 in china_map:
26         while not exit_flag:
27             for i2 in china_map[choice1]:
28                 print("\t"+i2)
29             choice2 = input("\t>>>choice2:")
30             if choice2 in china_map[choice1]:
31                 while not exit_flag:
32                     for i3 in china_map[choice1][choice2]:
33                         print("\t\t"+i3)
34                     choice3 = input("\t\t>>>choice3:")
35                     if choice3 in china_map[choice1][choice2]:
36                         print(choice3+"位于"+choice1+choice2)
37                     elif choice3=="b":
38                         break
39                     elif choice3=="q":
40                         exit_flag=True
41             elif choice2 == "b":
42                 break
43             elif choice2 == "q":
44                 exit_flag = True
45     elif choice1 == "q":
46         exit_flag = True
47     else:
48         print("input error")

级联菜单输出

posted on 2017-09-11 12:42  NullMoneyException  阅读(630)  评论(0编辑  收藏  举报