首页 > 其他 > 详细

小实验2:三级菜单

时间:2017-07-14 14:11:10      阅读:275      评论:0      收藏:0      [点我收藏+]
# Author:Alano

city = {
    "tianjin":{
        "Hedong":{
            "shiyijinglu":{"1"},
            "ergong":{"2"},
            "haihe":{"3"},
        },
        "Hexiqu":{
            "meiling":{},
            "Meiguihuayuan":{},
            "TJtushuguan":{},
        },
        "Hebeiqu":{
            "nankoulu":{},
            "Xukai":{},
            "Zhangyi":{},
        },
        },
    "beijing":{},
    "Hebeisheng":{},
 }

while True:
    for i in city:
        print(i)
    choice = input("Do you want to go >>>")
    if choice in city:
        while True:
            for i2 in city[choice]:
                print(i2)
            choice2 = input("Do you want to go >>>")
            if choice2 in city[choice]:
                while True:
                    for i3 in city[choice][choice2]:
                        print(i3)
                    choice3 = input("Do you want to go >>>")
                    if choice3 in city[choice][choice2]:
                        for i4 in city[choice][choice2][choice3]:
                            print(i4)
                            choice4 = input("Turn Back set (q)>>>")
                            if choice4 == "q":
                                break
                    if choice3 == "q":
                        break
            if choice2 == "q":
                break
    if choice == "q":
        print("This is top!")

 

小实验2:三级菜单

原文:http://www.cnblogs.com/xiapu5150/p/7169926.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!