Python code-Level 3 logon,

Source: Internet
Author: User

Python code-Level 3 logon,

#-*-Coding: UTF-8 -*-
# Author: Mr Gan

China_map = {
"South China ":
{
"Guangdong Province": {"Guangzhou City": ["Yuexiu District", "Tianhe District"], "Dongguan City": ["getai district", "vicissitudes district"]},
"Hainan Province": {"Haikou City": ["longhe district", "Fengtai District"], "Sanya City": ["Cangshan district", "Jin 'an district"]}
},
"North China ":
{
"Hebei Province": {"Shijiazhuang City": ['taizhou district ', 'hanoi district'], "Tangshan City": ['tainan district ', 'xiong'an district']}
}}
While True:
For I in china_map: # traverse the first level key
Print (I)
Choice_1 = input ("select to enter": ")
If choice_1 in china_map:
While True:
For i2 in china_map [choice_1]: # traverse the second-level key
Print ("\ t", i2)
Choice_2 = input ("select to enter": ")
If choice_2 = "q ":
Break
If choice_2 in china_map [choice_1]:
While True:
For i3 in china_map [choice_1] [choice_2]: # traverse Level 3 key
Print ("\ t", i3)

Choice_3 = input ("select to enter": ")
If choice_3 = "q ":
Break
If choice_3 in china_map [choice_1] [choice_2]:
While True:
For i4 in china_map [choice_1] [choice_2] [choice_3]:
Print ("\ t", i4)
Choice_4 = input ("last layer, return by q :")
If choice_4 = "q ":
Break
Else:
Pass

Code is a bit low

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.