标签:华夏 toolbar abs auto continue author 选择 menu bar
# version: python3.2.5 # author: ‘FTL1012‘ # time: 2017/12/7 09:16 menu = { ‘陕西‘: { ‘西安‘: { ‘未名区‘: [‘国美‘, ‘苏宁‘, ‘京东‘], ‘无名区‘: [‘百度‘, ‘360 ‘, ‘搜狗‘], ‘优雅区‘: [‘腾讯‘, ‘默默‘, ‘订订‘] }, ‘宝鸡‘: { ‘进队区‘: [‘word‘, ‘excel‘, ‘ppt‘], ‘挖第区‘: [‘华为‘, ‘锤子‘, ‘小米‘], ‘阿克区‘: [‘adidas‘, ‘unique‘, ‘masterbrown‘] }, ‘汉中‘: { ‘呵呵区‘: [‘流浪‘, ‘excel‘, ‘ppt‘], ‘幻化区‘: [‘猥琐‘, ‘发育‘, ‘别浪‘], ‘三只区‘: [‘后裔‘, ‘李白‘, ‘杜甫‘] }, }, ‘山东‘: { ‘山东市‘: { ‘惠普区‘: [‘华夏‘, ‘建设‘, ‘农行‘] } }, ‘湖南‘: { ‘长沙‘: { ‘豆腐区‘: [‘键盘‘, ‘鼠标‘, ‘显示器‘] } } } # print(menu[‘陕西‘][‘宝鸡‘]) flag = False while not flag: print("第一级".center(50, ‘*‘)) for k in menu: print(‘>>1: ‘, k) choice1 = input("请选择:") if choice1 in menu: print("第二级".center(50, ‘*‘)) for key1 in menu[choice1]: print(‘>>2: ‘, key1) while not flag: choice2 = input("请选择:") if choice2 in menu[choice1]: print("第三级".center(50, ‘*‘)) for key2 in menu[choice1][choice2]: print(‘>>3: ‘, key2) while not flag: choice3 = input("请选择:") if choice3 in menu[choice1][choice2]: print("第四级".center(50, ‘*‘)) for key3 in menu[choice1][choice2][choice3]: print(‘>>4: ‘, key3) print("最后一级了...") flag = True elif choice2 == ‘q‘: exit(0) elif choice2 == ‘b‘: flag = True else: print("输入不合法...") continue else: flag = False elif choice2 == ‘q‘: exit(0) elif choice2 == ‘b‘: flag = True else: print("输入不合法...") continue else: flag = False elif choice1 == ‘q‘: exit(0) elif choice1 == ‘b‘: continue else: print("输入不合法...") else: print("游戏结束...") 【稍有小bug】
标签:华夏 toolbar abs auto continue author 选择 menu bar
原文地址:https://www.cnblogs.com/ftl1012/p/9382386.html