Python's third-level menu

Source: Internet
Author: User

#author:zhouyuarea = {     ' Guangdong ':{         ' Jieyang ':{             ' puning ':{                  ' Lake ',                  ' Plum Pond ',                  ' Quicksand '                      },              ' Hongyang ': {' 1 ', ' 2 '},              ' Jiexi ': {' 1 ', ' 2 '}},         ' Shenzhen ': {' 1 ', ' 2 '},          ' Guangzhou ': {' 1 ', ' 2 '}             },     ' Beijing ': {' 1 ', ' 2 '},     ' Sichuan ': {' 1 ', ' 2 '}} #先进入循环while  true: #打印出省份      for i in area:        print (i) #让用户选择省份     choose = input ("Please select Province:") #判断用户输入的省份在字典里面存在与否. The presence is down execute   not return # here to note, Choose in area means that the user input of the area is not present in the #area dictionary, if not exist to see if the user input is q, if the Q is to exit     if choose in area: #如果If判断是True的话, that should go into a cycle, but also constantly choose the city, #所以下面一定要是一个循环         while true: #打印出城市              for i2 in area[choose]:                 print (i2) #让用户输入城市              choose1 = input ("Please select City:") #判断用户输入的城市存不存在我们的列表中, if present, enter a loop , #如果不存在就看看用户输入的是否为q, if Q is the exit, if B is the return # The following explanation is the same   don't say it allSolution, if there is no understanding can add me:1090139534            if  choose1 in area[choose]:                 while True:                     for i3 in area[choose][choose1]:                          print (i3)                      choose2 = input ("Please select County:")                      if  choose2 in area[choose][choose1]:                         for i4 in area[choose][choose1][choose2]:                              print (I4)                          while  true:                             choose3 = input ("input ' B ' can return: ")                              if choose3 ==  ' B ':                                  break                     elif choose2 == ' Q ':                          exit ("Thankyou for use")                      elif choose2 == ' B ':                          break            elif  choose1 ==  ' Q ':                 exit ("Thankyou for use")              elif choose1 ==  ' B ':                 break    elif choose ==  ' Q ':         exit ("Thank you foruse")



This article is from "Love Zhou Yu" blog, please be sure to keep this source http://izhouyu.blog.51cto.com/10318932/1964447

Python's third-level menu

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.