Python Basics-Day 1 Assignment-three tier menu level three menus

Source: Internet
Author: User

Job Requirements

1. Run the program output first level menu

2. Select a Level menu item, output level two menu, output level three menu similarly

3. Menu data saved in file

4. Let the user choose whether or not to exit

5. There is a function to return to the top level menu

Scoring criteria:

Complete the job 2,85 with multi-layer nested while loop

Complete the assignment with only one layer of cycle 2,100 points

SAMPLE 1
data = {    'Beijing': {        'Haidian': {            'Five crossing': {                'Soho': {},                'NetEase': {},                'Google': {},            },            'Zhongguancun': {                'Iqiyi Art': {},                'Autohome': {},                'Youku': {},            },            'on the ground': {                'Baidu': {},            },        },        'changping': {            'Shahe': {                'Oldboy': {},                'Beihang University': {},            },            'Tin Tong Court': {},            'Huilongguan': {},        },        'Chaoyang': {},        'Dongcheng': {},    },    'Shanghai': {        "Huangpu": {            'People's square': {                'Fried Chicken Shop': {},            },        },        'Zhabei': {            'train station': {                'Ctrip': {},            },        },        'Pudong': {},    },    'Shandong': {},}exit_flag=False while  notExit_flag: forIinchData:Print(i)#into the dead loop .Choice= Input ("your option >>>:")    ifChoiceinchData: while  notExit_flag: forJinchData[choice]:Print("\ t", j) Choice2= Input ('your 2nd option >>>:')             while  notExit_flag: forKinchData[choice][choice2]:Print('\t\t', K) Choice3= Input ('your 3rd option >>>:')                ifChoice3inchData[choice][choice2]: forLinchData[choice][choice2][choice3]:Print('\t\t', L) Choice4= Input ("final, please input B for exit")                    ifChoice4 = ='b':                        Pass  #pass = = Do not do anything, must write otherwise error. As a placeholder                    elifChoice4 = ="Q": Exit_flag=TrueifChoice3 = ='b':                     Break                elifChoice3 = ="Q": Exit_flag=TrueifChoice2 = ='b':                 Break            elifChoice2 = ="Q": Exit_flag= True
View Code

Python Basics-Day 1 Assignment-three tier menu level three menus

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.