Python Authoring Region selection-dict

Source: Internet
Author: User

"' Mutselect of the place name.1.1-3 to three layer2. ' Q " to exit.3." B " to back.4.other words to retry." kyewords= (' 1 ', ' 2 ', ' 3 ', ' Q ', ' Q ') placename={"Liaoning": {"Dalian":("high-tech", "Zhongshan"), "Shenyang":("Tiexi", "Hun nan"), "Huludao":("Lotus Mountain", "Xingcheng")},        "Jilin": {"Changchun":("Dawa", "Gao Tian"), "siping":("Er River", "Lu Yang"), "Tongliao":("Tonghua", "Underworld")},        "Heilongjiang": {"Hal":("Pingshan", "Yang"), "daqing":("Black Oil", "thousand"), "Mohe":("Russia", "northernmost")}}def province (placename):          #提取省份到列表     ProvinceList=[]     j=1    for i in placename.keys ():         provincelist=provincelist+[i]        print (J, '. ', i)         j+=1    return  (provincelist) def  jugdeinput (inputlist):     proname= ""   &Nbsp; prvalue=input ("please select provide number,press  ' Q '  to exit:")     if prvalue== ' 1 '  :        proname= inputlist[0]    elif prvalue== ' 2 ':         proname=inputlist[1]    elif prvalue== ' 3 ':         proname=inputlist[2]    elif prvalue== ' q '  or prvalue== ' Q ':         print ("Tuichu")          Return (' 0 ')     elif prvalue== ' B '  or prvalue== ' B ':         return ('-1 ')     else:         return    print ("You select%s, the following is its 1 sub-region:"%proname)     return (ProName) While true:   &nbsP Provincelists=province (placename)     aaaa=jugdeinput (provincelists)      if aaaa== ' 0 ':         break    elif  placename.__contains__ (AAAA):         cityname=placename[aaaa]         while True:             citylists=province (CityName)              bbbb= jugdeinput (citylists)              if bbbb== ' 0 ':                 aaaa= ' 0 '                  break            elif  Cityname.__contains__ (BBBB):  &Nbsp;              countrylist=cityname[ bbbb]                for  name in countrylist:                     print (name)                  while True:                     lastvalue=input ("Please press   ' B '  to return or  ' Q '  to quit: ")                      if lastvalue== ' Q '  or  lastvalue== ' Q ':                         bbbb= ' 0 '                          aaaa= ' 0 '                           break                     elif lastvalue== ' B '  or lastvalue== ' B ':                          break                     else:                         continue             elif bbbb== '-1 ':                 break                         if aaaa== ' 0 ':                 break         if aaaa== ' 0 ':             Breakprint (' This query has ended! ')

Python's List,dict method is not fully recorded and needs to be strengthened. I do not know why 3.0 is not compatible with 2.0, reading all look mixed, we must pay attention!

This article comes from "Looking back on the empty" blog, so be sure to keep this source http://yishi.blog.51cto.com/1059986/1978271

Python Authoring Region selection-dict

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.