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