码迷,mamicode.com
首页 > 编程语言 > 详细

python的学习笔记/002-5.1(2018-5-21)

时间:2018-05-21 12:24:15      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:字典(dict)的应用三级菜单

还需要修改

_3_food_list={
    ‘主食‘:{
        ‘米饭‘:{
                 ‘大米饭‘:["大份","中份","小份"],
                 ‘小米饭‘:["大份","中份","小份"]
                },
        ‘面食‘:{‘面‘:["大份","中份","小份"],
                 ‘炒面‘:["大份","中份","小份"],
                 ‘拌面‘:["大份","中份","小份"]
                }
        },
    ‘锅类‘:{
          ‘荤锅‘:{
                   ‘海带排骨锅‘:["大锅","中锅","小锅"],
                    ‘辣牛肉锅‘:["大锅","中锅","小锅"]
                   },
          ‘素锅‘:{
                   ‘豆腐锅‘:["中锅","小锅"],
                   ‘珍珠翡翠白玉锅‘:["大锅","中锅","小锅"]
                  }
           },
    ‘饮品‘:{
         ‘奶茶‘:{
                  ‘原味奶茶‘:["热","加冰"],
                  ‘草莓奶茶‘:["热","加冰"]
                 },
         ‘饮料‘:{
                  ‘可口可乐‘:["大杯","中杯"],
                  ‘红牛‘:["大杯","中杯"]
               }
    }
}
exit_flag=False
while not exit_flag :
    for i in _3_food_list:
        print(i)
    choice1=input(">>>please input 1:")
    while not exit_flag:
      if choice1 in _3_food_list:
         for i in _3_food_list[choice1]:
             print(i)
         choice2=input("\t>>>please input 2:")
         if choice2 in _3_food_list[choice1]:
            for i in _3_food_list[choice1][choice2]:
                print(i)
            choice3=input("\t\t>>>please input 3 :")
            while not exit_flag:
                if choice3 in _3_food_list[choice1][choice2]:
                     for i in _3_food_list[choice1][choice2][choice3]:
                        print(i)
                     choice4=input("\t\t\t>>>please iput 4 :")

                     if choice4 in _3_food_list[choice1][choice2][choice3]:
                           print(choice4 )
                           choice5=input(">>>the last back(b):")
                           if choice5==‘b‘:
                               pass
                           elif choice5==‘q‘:
                               exit_flag =True
                     if choice4==‘b‘:
                         break
                     elif choice4==‘q‘:
                        exit_flag =True
                if choice3 == ‘b‘:
                   break
                elif choice3== ‘q‘:
                   exit_flag = True
         if choice2 == ‘b‘:
             break
         elif choice2 == ‘q‘:
             exit_flag = True
      if choice1 == ‘b‘:
          break
      elif choice1 == ‘q‘:
          exit_flag = True

python的学习笔记/002-5.1(2018-5-21)

标签:字典(dict)的应用三级菜单

原文地址:http://blog.51cto.com/13747953/2118612

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!