首页 > 代码库 > 多级菜单实现

多级菜单实现


 1 __author__ = ZZG
 2 ‘‘‘
 3 这个程序只用来测试中国,另外实现到省一级别。(国家-地区-省份)
 4 
 5  ‘‘‘
 6 p1 = [北京,天津,河北,山西,内蒙古]
 7 p2 = [湖北,湖南,河南,江西]
 8 p3 = [广东,广西,海南]
 9 p4 = [山东,江苏,安徽,浙江,上海,福建]
10 p5 = [辽宁,吉林,黑龙江]
11 p6 = [四川,云南,贵州,西藏,重庆]
12 p7 = [宁夏,新疆,青海,陕西,甘肃]
13 p8 = [香港,澳门,台湾]
14 
15 region = [华北, 华中, 华南, 华东, 东北, 西南, 西北, 港澳台]
16 province = [p1, p2, p3, p4, p5, p6, p7, p8]
17 adict = dict(zip(region,province))
18 #print(adict)
19 country = ("China",America,Kereo,Japen,Europe)
20 print(country)
21 
22 while True:
23     w_country = input(please enter your  country from up-list or enter "Back" to return:)
24 
25     if w_country == "China":
26         print(region)
27         w_region = input(please enter your region of country or enter "Back" to return:)
28         if w_region == Back:
29             print(country)
30         else:
31             print(adict[w_region])
32 
33     elif w_country == Back:
34         print("China",America,Kereo,Japen,Europe)
35     else:
36         print(sorry we cannot to go there)

2017-06-19 18:54:57


这是自己完成的第二个小编程,感觉不错!继续努力

 

多级菜单实现