Level three menu, compare low level, subsequent learning function call
1 #-*-coding:utf-8-*-2 #LC3data = {4 "Zhejiang province":{5 "Hangzhou City":{6 "West L. District":["West Lake","Huanglong"],7 "Yuhang":["Xixi Silver Thai","Busy Lake"],8 "Bingjiang District":["Avenue of Fame","Garbage Street"]9 },Ten "Wenzhou":{ One "Ouhai":["Wenzhou University","Cha Shan"], A "Cangnan":["Jinxiang","Ling Xi"] - }, - "Taizhou":{ the "Luqiao":["Seafood","Sprayer"], - "Wenling":["Takayama","Green leaves"] - } - }, + "Guangdong province":{ - "Guangzhou" + } A } at -Exit_flag =True - - whileExit_flag: - forIinchData: - Print(i) inChoice = input ("Please select 1>>>:")#Select Province - ifChoiceinchData: to whileExit_flag: + forJinchData[choice]: - Print(j) theChoice2 = input ("Please select 2, return to the previous level please press B, exit please press Q>>>:")#Select City * ifChoice2inchData[choice]: $ whileExit_flag:Panax Notoginseng forKinchData[choice][choice2]: - Print(k) theChoice3 = input ("Please select 3, return to the previous level please press B, exit please press Q>>>:")#Selection Area + ifChoice3inchData[choice][choice2]: A forLinchData[choice][choice2][choice3]: the Print(L) +Choice4 = input ("last layer, go back to the previous level, press B, exit please press Q>>>:") - ifChoice4 = ="b": $ Break $ elifChoice4 = ="Q": -Exit_flag =False - elifChoice3 = ="b":#If you choose to return, this cycle is interrupted the Break - elifChoice3 = ="Q":#If you choose to exit, change the loop value to False, end all loops, exitWuyiExit_flag =False the Else: - Print("wrong choice, re-enter! ") Wu Continue - elifChoice2 = ="b": About Break $ elifChoice2 = ="Q": -Exit_flag =False - Else: - Print("wrong choice, re-enter! ") A Continue
Python---Level three menu