Python Topic 2: Multi-layered menus, entry and exit (dictionary)

Source: Internet
Author: User

Level 3 menu, can go to the next level, can retreat to the previous level

Date = {"1": {"one": {"111": ["A", "B"], "("): ["C", "D"],}, "12": { "121": ["E", "F"], "122": ["G", "H"]}}, "2": {}, "3": {}}exit_flag = Falsewhile No T exit_flag:for i in Date:print (i) Choice = input ("SELECT INTO 1>>:") If choice in Date:while not            Exit_flag:for i2 in Date[choice]: print ("\ T", i2) Choice2 = input ("SELECT INTO 2>>:") If Choice2 in Date[choice]: And not exit_flag:for i3 in Date[choice][choice 2]: Print ("\t\t", i3) Choice3 = input ("Select Enter 3>>:") if Cho                            Ice3 in Date[choice][choice2]: for I4 in Date[choice][choice2][choice3]:                         Print ("\t\t", i4) Choice4 = input ("Last layer, press B to return >>:") if Choice4 = = "B":   Pass Elif Choice4 = = "Q": Exit_flag = True if Choi            Ce3 = = "B": break elif Choice3 = = "Q": Exit_flag = True if Choice2 = = "B": break elif Choice2 = = "Q": Exit_flag = True

  

Python Topic 2: Multi-layered menus, entry and exit (dictionary)

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.