Python Road day2 Three-level menu of the dictionary exercises

Source: Internet
Author: User

1 #Author:ersa2 " "3 Program: Level three menu4 Requirements:5 print provincial, city, and county level three menus6 can return to the upper level7 can exit the program at any time8 " "9menu = {Ten     'Beijing':{ One         'Haidian':{ A             'Five crossing':{ -                 'Soho':{}, -                 'NetEase':{}, the                 'Google':{} -             }, -             'Zhongguancun':{ -                 'Iqiyi Art':{}, +                 'Autohome':{}, -                 'Youku':{}, +             }, A             'on the ground':{ at                 'Baidu':{}, -             }, -         }, -         'changping':{ -             'Shahe':{ -                 'old boy':{}, in                 'Beihang University':{}, -             }, to             'Tin Tong Court':{}, +             'Huilongguan':{}, -         }, the         'Chaoyang':{}, *         'Dongcheng':{}, $     },Panax Notoginseng     'Shanghai':{ -         'Minhang':{ the             "People's square":{ +                 'Fried Chicken Shop':{} A             } the         }, +         'Zhabei':{ -             'Train Warfare':{ $                 'Ctrip':{} $             } -         }, -         'Pudong':{}, the     } - }Wuyi  theIs_continue =True -  whileis_continue: Wu          forIinchMenu: -             Print(i) AboutChoice = input ("\ t chooses to go to the subordinate menu 1>>>:") $  -         ifChoiceinchMenu: -              whileis_continue: -                  forI2inchMenu[choice]: A                     Print("\ t", I2) +Choice2 = input ("\t\t choose to go to sub-menu 2>>>:") the                 ifChoice2inchMenu[choice]: -                      whileis_continue: $                          fori3inchMenu[choice][choice2]: the                             Print("\t\t", i3) theChoice3 = input ("\t\t\t choose to go to sub-menu 3>>>:") the                         ifChoice3inchMenu[choice][choice2]: the                              whileis_continue: -                                  forI4inchMenu[choice][choice2][choice3]: in                                     Print("\t\t\t", I4) theChoice4 = input ("\t\t\t return to Superior: B exit: Q>>>:") the                                 ifChoice4 = ="b": About                                      Break the                                 elifChoice4 = ="Q": theIs_continue =False the                         ifChoice3 = ="b": +                              Break -                         elifChoice3 = ="Q": theIs_continue =FalseBayi                 elifChoice2 = ="b": the                      Break the                 elifChoice2 = ="Q": -Is_continue =False -         elifChoice = ='b': the              Break the         elifChoice = ="Q": theIs_continue = False

Python Road day2 Three-level menu of the dictionary exercises

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.