Python Level three menu operation

Source: Internet
Author: User

Address_info = {
"China": {
"Shanxi": {
"Taiyuan": ["Small Shop", "Yinze"],
"Changzhi": ["eldest son", "Changzhi County"]
},
"Shaanxi": ["Hanzhong", "Xianyang"],
"Hebei": ["Shijiazhuang", "Handan"]
},
"United States": {
"New York": ["a", "B"],
"Miami": ["C", "D"],
"Houston": ["E", "F"]
}
}
Exit_flag = True

While Exit_flag:
For I in Address_info:
Print (i)
Choice = input ("Select Enter 1>>:")
If choice in Address_info:
While Exit_flag:
For I2 in Address_info[choice]:
Print ("\ T", I2)
Choice2 = Input ("Select Enter 2>>:")
If Choice2 in Address_info[choice]:
While Exit_flag:
For I2 in Address_info[choice][choice2]:
Print ("\ T", I2)
Choice3 = Input ("Select Enter 3>>:")
If Choice3 in Address_info[choice][choice2]:
While Exit_flag:
For i3 in Address_info[choice][choice2][choice3]:
Print ("\ T", i3)
Choice4 = input ("Press B to return:")
if Choice4 = = "B":
Break
elif Choice4 = = "Q":
Exit_flag = False
if choice3 = = "B":
Break
elif Choice3 = = "Q":
Exit_flag = False
if Choice2 = = "B":
Break
elif Choice2 = = "Q":
Exit_flag = False
if choice = = "B":
Pass
elif Choice = = "Q":
Exit_flag = False

Python Level three menu operation

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.