Job Requirements
1. Run the program output first level menu
2. Select a Level menu item, output level two menu, output level three menu similarly
3. Menu data saved in file
4. Let the user choose whether or not to exit
5. There is a function to return to the top level menu
Scoring criteria:
Complete the job 2,85 with multi-layer nested while loop
Complete the assignment with only one layer of cycle 2,100 points
SAMPLE 1
data = { 'Beijing': { 'Haidian': { 'Five crossing': { 'Soho': {}, 'NetEase': {}, 'Google': {}, }, 'Zhongguancun': { 'Iqiyi Art': {}, 'Autohome': {}, 'Youku': {}, }, 'on the ground': { 'Baidu': {}, }, }, 'changping': { 'Shahe': { 'Oldboy': {}, 'Beihang University': {}, }, 'Tin Tong Court': {}, 'Huilongguan': {}, }, 'Chaoyang': {}, 'Dongcheng': {}, }, 'Shanghai': { "Huangpu": { 'People's square': { 'Fried Chicken Shop': {}, }, }, 'Zhabei': { 'train station': { 'Ctrip': {}, }, }, 'Pudong': {}, }, 'Shandong': {},}exit_flag=False while notExit_flag: forIinchData:Print(i)#into the dead loop .Choice= Input ("your option >>>:") ifChoiceinchData: while notExit_flag: forJinchData[choice]:Print("\ t", j) Choice2= Input ('your 2nd option >>>:') while notExit_flag: forKinchData[choice][choice2]:Print('\t\t', K) Choice3= Input ('your 3rd option >>>:') ifChoice3inchData[choice][choice2]: forLinchData[choice][choice2][choice3]:Print('\t\t', L) Choice4= Input ("final, please input B for exit") ifChoice4 = ='b': Pass #pass = = Do not do anything, must write otherwise error. As a placeholder elifChoice4 = ="Q": Exit_flag=TrueifChoice3 = ='b': Break elifChoice3 = ="Q": Exit_flag=TrueifChoice2 = ='b': Break elifChoice2 = ="Q": Exit_flag= True
View Code
Python Basics-Day 1 Assignment-three tier menu level three menus