首页 > 代码库 > 51_work--三级菜单
51_work--三级菜单
menu={ ‘shandong‘:{ ‘qingdao‘:[‘sifang‘,‘haungdao‘], ‘jinan‘:[‘licheng‘,‘zhangqiu‘] }, ‘zhejiang‘:{ ‘hangzhou‘:[‘xihu‘,‘binjiang‘], ‘wnzhou‘:[‘lucheng‘,‘longwan‘] }, ‘guangdong‘:{ ‘shenzheng‘:[‘futian‘,‘nanshan‘], ‘guangzhou‘:[‘zhuhai‘,‘baiyuan‘] } } flag=True while flag: for i in menu: print(i) menu1=input(‘Please enter the menu1>>>:‘) if menu1 in menu: while flag: for i1 in menu[menu1]: print(i1) menu2 = input(‘Please enter the menu2>>>:‘) if menu2 in menu[menu1]: for i2 in menu[menu1][menu2]: print(i2) menu3=input(‘This is the last level menu and press b to return to the previous level >>>:‘) if menu3==‘b‘: pass elif menu3==‘q‘: flag=False else: print(‘The input is incorrect. Please re-enter it‘) elif menu2==‘b‘: break elif menu2==‘q‘: flag=False else: print(‘The input is incorrect. Please re-enter it‘) elif menu1 == ‘b‘: print(‘The first level menu can not be returned‘) elif menu1 == ‘q‘: flag = False else: print(‘The input is incorrect. Please re-enter it‘)
51_work--三级菜单
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。