[PYTHON] Three-Level menu,

Source: Internet
Author: User

[PYTHON] Three-Level menu,

1 # Author: Stephen Yuan 2 3 area_range = {4 'guangdong province ': {5 'guangzhou City': {6 'haizhu district ': ['total area of 90.40 square kilometers', 'September 2015, the total GDP of Haizhu District reaches 142.297 billion RMB], and the 7' liwan district ': ['total area of 62.40 square kilometers', 'total GDP of liwan district reached 2015 RMB in 97.033 billion '], and the 8' Huadu District ': ['total area of 970.04 square kilometers ', 'total GDP in liwan district reached 2015 RMB in 100.311 billion'] 9}, 10 'shenzhen City ': {11 'luohu district ': ['Land area of Luohu District is 78.75 square kilometers ', 'total output of Luohu District reached 2016 RMB in 197.407 billion'], 12 'futian district ': ['Land area of Futian district is 98.66 square kilometers ', 'In 2016, the total production value of Futian district reached 220.022 billion yuan '], 13 'nanshan district': ['Land area of Nanshan District is 78.75 square meters KM ', 'in 2016, the total production value of Nanshan District reached 210.015 billion yuan'] 14}, 15 'zhuhai City ': {16 'xiangzhou district': ['the land area of Xiangzhou District is 78.75 square kilometers ', 'In 2016, the total production value of Xiangzhou District reached 300.025 billion yuan '], 17 'jinwan district': ['jinwan district's land area is 78.75 square kilometers ', 'in 2016, the total production value of jinwan district reached 356.438 billion yuan'], 18 'doumen region': ['doumen regions' land area is 78.75 square kilometers '. 'In 2016, the total production value of doumen district reached 312.545 billion RMB'] 19} 20}, 21 'hubei province ': {22 'wuhan City ': {23 'jiang 'an district': ['jiang 'an district's land area is 78.75 square kilometers ', 'in 2016, the total production value of Jiang 'an district reached 345.418 billion yuan'], 24 'Han Yang District ': ['Land area of Hanyang district is 78.75 square kilometers ', 'in 2016, the total production value of Hanyang district reached 786.428 billion yuan'], 25 'wuchang district ': ['wuchang district jurisdiction The land area is 78.75 square kilometers. 'In 2016, the total production value of Wuchang district reached 642.167 billion yuan '], 26}, 27 'huangshi City': {28 'Land area ': ['Land area of the land area of 78.75 square kilometers ', '2017, the total production value of the land area of 448.528 billion RMB ', 'In 2016, the total production value of Tieshan district reached 120.045 billion yuan '], and 30 'daye City': ['daye city's land area is 78.75 square kilometers ', 'September 2016, the total production value of Daye city reached 245.232 billion yuan '] 31}, 32 'huanggang City': {33 'huangzhou district ': ['Land area of Huangzhou District 78.75 square kilometers', 'September 2016, the total GDP of Huangzhou District reaches 482.146 billion RMB], and 34 'macheng': ['macheng city's land area is 78.75 square kilometers '. 'In 2016, the total GDP of Macheng City reached 621.345 billion RMB'], 35 'wuxue City ': ['wuxue City Area Building 78.75 square kilometers, 'july 2016, the total production value of Wuxue city reached 454.868 billion yuan '] 36} 37}, 38 'hunan province': {39 'changsha City ': {40 'furong district ': ['Land area of the Furong district is 78.75 square kilometers ', 'in 481.353 billion, the total production value of the Furong district reached 78.75 RMB'], 41 'tianxin region': ['Land area of the area of tiance ', 'In 2016, the total production value of the Tianfu district reached 678.464 billion yuan '], 42 'kaifu region': ['kaifu district's land area is 78.75 square kilometers', 'in 2016, Kaifu district's total production value reached 234.545 billion yuan '], 43}, 44 'zhuzhou City ': {45 'hetang district': ['the land area of the hetang district is 78.75 square kilometers '. 'In 2016, the total production value of the hetang district reached 486.115 billion yuan'], 46 'luyun district ': ['Land area of the luyun district is 78.75 square kilometers'. 'In 2016, the total production value of the luyun district reached 197.435 billion yuan '], 47 'shifeng district': ['Shifeng district's land area is 78.75 square kilometers ', 'in 2016, the total production value of Shifeng district reached 154.678 billion yuan'] 48}, 49 'shaoyang City ': {50 'shuangqing district ': ['Land area in Shuangqing district is 78.75 square kilometers ', 'in 2016, the total production value of Shuangqing district reached 654.185 billion yuan'], 51 'Grand Xiang region': ['Land area in DaXiang district is 78.75 square kilometers ', 'july 2016, the total production value of the Greater Xiang district reached 546.174 billion yuan '], 52 'North tower region': ['Land area of the northern tower district is 78.75 square kilometers', 'September 2016, north Tower GDP reaches 481.586 billion yuan '] 53} 54} 55} 56 57 while True: 58 for I in area_range: 59 print (I) 60 print ("last level, return to the top layer, press 'B', and then press 'q'.) 61 choice_1 = input (select province>: ') 62 if choice_1 in area _ Range: 63 while True: 64 for i2 in area_range [choice_1]: 65 print (i2) 66 choice_2 = input ('select city >>> :') 67 if choice_2 in area_range [choice_1]: 68 while True: 69 for i3 in area_range [choice_1] [choice_2]: 70 print (i3) 71 choice_3 = input ('selection area >>:') 72 if choice_3 in area_range [choice_1] [choice_2]: 73 while True: 74 for i4 in area_range [choice_1] [choice_2] [choice_3]: 75 print (i4) 76 choice_4 = input ("last level, return the previous layer 'B' Key, exit and press the 'q' key >>>: ") 77 if choice_4 = 'B': 78 break79 elif choice_4 = 'q': 80 exit () 81 else: 82 print ("Invalid selection. Please enter it again! ") 83 elif choice_3 = 'B': 84 break85 elif choice_3 = 'q': 86 exit () 87 else: 88 print (" Invalid selection, please enter it again! ") 89 elif choice_2 = 'B': 90 break91 elif choice_2 = 'q': 92 exit () 93 else: 94 print (" Invalid selection, please enter it again! ") 95 elif choice_1 = 'q': 96 exit () 97 else: 98 print (" Invalid selection, please enter it again! ")

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.