Python Level Three Menu example

Source: Internet
Author: User

Print province, city, and county level three menu can return to the previous level can exit the program at any time
__author__="Alex Li"Data= {    'Beijing':{        "changping":{            "Shahe":["Oldboy","Test"],            "Tin Tong Court":["Chain Home Property","I love my family ."]        },        "Chaoyang":{            "Wangjing":["Mercedes","mo Mo"],            "Guomao":{"CICC","HP"},            "Dong Zhi men":{"Advent","fetion"},        },        "Haidian":{},    },    'Shandong':{        "Texas":{},        "Qingdao":{},        "Jinan":{}    },    'Guangdong':{        "Dongguan":{},        "Changshu":{},        "Foshan": {},},}exit_flag=False while  notExit_flag: forIinchData:Print(i) Choice= Input ("choose to enter 1>>:")    ifChoiceinchData: while  notExit_flag: forI2inchData[choice]:Print("\ t", I2) Choice2= Input ("choose to enter 2>>:")            ifChoice2inchData[choice]: while  notExit_flag: fori3inchData[choice][choice2]:Print("\t\t", i3) Choice3= Input ("choose to enter 3>>:")                    ifChoice3inchData[choice][choice2]: forI4inchData[choice][choice2][choice3]:Print("\t\t", I4) Choice4= Input ("last layer, press B to return to >>:")                        ifChoice4 = ="b":                            Pass                        elifChoice4 = ="Q": Exit_flag=TrueifChoice3 = ="b":                         Break                    elifChoice3 = ="Q": Exit_flag=TrueifChoice2 = ="b":                 Break            elifChoice2 = ="Q": Exit_flag= True

Python Level Three Menu example

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.