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

课堂三级菜单

时间:2017-12-25 01:02:16      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:choice   blog   int   put   北京   class   break   log   for   

import os



a = {
    "安徽": {
        "合肥" : {
            "合肥1":{},
            "合肥2":{},
            "合肥3":{},
            "合肥4":{},
        },
        "淮南" : {
            "淮南1":{},
            "淮南2":{},
            "淮南3":{},
            "淮南4":{},
        },
        "肥东" : {
            "肥东1":{},
            "肥东2":{},
            "肥东3":{},
            "肥东4":{},
        },
    },
    "河南": {
        "安阳" : {
            "安阳1":{},
            "安阳2":{},
            "安阳3":{},
            "安阳4":{},
        },
        "洛阳" : {
            "洛阳1":{},
            "洛阳2":{},
            "洛阳3":{},
            "洛阳4":{},
        },
        "开封" : {
            "开封1":{},
            "开封2":{},
            "开封3":{},
            "开封4":{},
        },
    },
    "河北": {
        "唐山": {
            "唐山1":{},
            "唐山2":{},
            "唐山3":{},
            "唐山4":{},
        },
        "北京": {
            "北京1":{},
            "北京2":{},
            "北京3":{},
            "北京4":{},
        },
        "天津": {
            "天津1":{},
            "天津2":{},
            "天津3":{},
            "天津4":{},
        },
    }
}

while True:
    for keys in a:
        print(keys)
    choice = input("1>>>")
    if choice in a:
        while True:
            for keys2 in a[choice]:
                print(keys2)
            choice2 = input("2>>>")
            if choice2 in a[choice]:
                while True:
                    for keys3 in a[choice][choice2]:
                        print(keys3)
                    choice3 = input("3>>>")
                    if choice3 == "返回":
                        break
                    elif choice3 == "退出":
                        exit()
            elif choice2 == "返回":
                break
            elif choice2 == "退出":
                exit()
    elif choice == "退出":
        exit()

 

课堂三级菜单

标签:choice   blog   int   put   北京   class   break   log   for   

原文地址:http://www.cnblogs.com/GhostCatcg/p/8099637.html

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