006 menu exercises (TAG bit), 006 ← ↓

Source: Internet
Author: User

006 menu exercises (TAG bit), 006 ← ↓

 

Exit () is not required to exit the program ()

 

#01 code

1 #__ author: _ nbloser 2 # date: 3 4 5 shaoguan = ['renhua ', 'shixing', 'lechang ', 'nanxiong '] 6 jiangmeng = ['kaiping', 'pengjiang', 'taishan ', 'heshan', 'enping'] 7 guangdong_province = {'shaoguan ': shaoguan, 'jiangmen ': jiangmeng} 8 9 nanchang = ['donghu', 'xihu ', 'new', 'anyi', 'jinxian'] 10 jingdezhen = ['changjiang ', 'zhushan', 'upping', 'fuliang '] 11 jiangxi_province = {'nanchang': nanchang, 'jingdezhen ': jingdezhen} 12 13 provinces = {'guangdong': guangdong_province, 'jiangxi ': jiangxi_province} 14 15 def pr (Array): 16 for I in array: 17 print (I, end = "") 18 print () 19 20 while True: 21 print ("province :", end = "") 22 name_province = list (provinces. keys () 23 # print (name_province) 24 pr (name_province) 25 pro_input = input ("Enter the province you want to view/Enter exit to exit :") 26 if pro_input = 'exit ': 27 exit () 28 if pro_input not in pro_input: 29 print ("this province is not available! ") 30 continue31 while True: 32 tmp_province = provinces [pro_input] 33 name_shis = list (tmp_province.keys () 34 # print (tmp_province) 35 pr (name_shis) 36 shi_input = input ("enter the city you want to view/Enter exit/Enter return to the previous layer:") 37 if shi_input = 'eg': 38 exit () 39 if shi_input = 'Return ': 40 break41 if shi_input not in tmp_province: 42 print ("no city! ") 43 continue44 while True: 45 tmp_county = tmp_province [shi_input] 46 pr (tmp_county) 47 county_input = input (" Enter exit to exit/Enter return to the previous layer :") 48 if county_input = 'exit ': 49 exit () 50 if county_input = 'Return': 51 break
View Code

 

Related Article

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.