码迷,mamicode.com
首页 > 其他好文 > 详细

day2-三级菜单

时间:2018-06-26 11:14:14      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:day   bsp   for   奔驰   code   int   div   put   山东   

 

#!/usr/bin/env python

data = {
    北京:{
        "昌平":{
            "望京1": {"奔驰", "默默"},
            "国贸2": ("cicc", "HP"),
        },
        "朝阳":{
            "望京1":{"奔驰","默默"},
            "国贸1":("cicc","HP"),
        },
    },
    山东:{
        "昌平": {
            "望京1": {"奔驰", "默默"},
            "国贸2": ("cicc", "HP"),
        },
        "朝阳": {
            "望京2": {"奔驰", "默默"},
            "国贸2": ("cicc", "HP"),
        },
    },
    广东:{
        "昌平": {
            "望京1": {"奔驰", "默默"},
            "国贸2": ("cicc", "HP"),
        },
        "朝阳": {
            "望京3": {"奔驰", "默默"},
            "国贸4": ("cicc", "HP"),
        },
    },
}
quit_q=""
while quit_q!=q:
    for i1 in data:
        print(i1)
    choice1=input("选择进入,按b返回,按q退出>>:")
    quit_q=choice1
    if choice1== b:
        break
    if choice1 in data:
        while quit_q!=q:
            for i2 in data[choice1]:
                print("\t",i2)
            choice2 = input("选择进入,按b返回,按q退出>>:")
            quit_q = choice2
            if choice2 == b:
                break
            if choice2 in data[choice1]:
                while quit_q!=q:
                    for i3 in data[choice1][choice2]:
                        print("\t\t", i3)
                    choice3 = input("选择进入,按b返回,按q退出>>:")
                    quit_q = choice3
                    if choice3 == b:
                        break
                    if choice3 in data[choice1][choice2]:
                        while quit_q != q:
                            for i4 in data[choice1][choice2][choice3]:
                                print("\t\t\t", i4)
                            choice4 = input("最后一层,按b返回,按q退出>>:")
                            quit_q = choice4
                            if choice4 == b:
                                break

 

day2-三级菜单

标签:day   bsp   for   奔驰   code   int   div   put   山东   

原文地址:https://www.cnblogs.com/a10086/p/9227244.html

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