zoukankan      html  css  js  c++  java
  • python第一天作业:字典

    作业三:多级菜单
    • 三级菜单
    • 可依次选择进入各子菜单
    • 所需新知识点:列表、字典

    break_flag = False
    count = 0
    while not break_flag:
    print("111111层")
    while not break_flag:
    print("222222222层")
    while not break_flag:
    print("3333333层")
    count += 1
    if count > 10:
    break_flag =True


    print("keep")


    menu = {
    '浙江':{
    '杭州':{
    '西湖':{
    '西溪',
    '三墩'},
    '滨江':{'滨和', '高新'}
    },
    '丽水':{
    '龙泉':{'宝剑', '瓷器'},
    '青田':{'石雕', '华侨'},
    '缙云':{'烧饼', '木雕'},
    },
    },
    '山东':{
    '烟台':{'大海', '日照'},
    '青岛':{'平度', '黄岛'},
    '东营':{'利津', '垦利'}
    },
    '广东':{
    '深圳':{'南山', '福田'},
    '梅州':{'五华', '兴宁'},
    '佛山':{'三水', '桂城'}
    }
    }

    ext_flage= False
    while not ext_flage:
    for lev1 in menu:
    print(lev1)
    choice = input("lev1>>:").strip()
    if len(choice) == 0: continue
    if choice == "b":break
    if choice == "q":
    ext_flage = True
    if choice in menu[choice]:
    while not ext_flage:
    for lev2 in menu[choice]:
    print(lev2)
    choice2 = input("lev2>>:").strip()
    if len(choice2) == 0 :continue
    if choice2 == "b":break
    if choice2 == "q":
    ext_flage = True
    if choice2 in menu[choice][choice2]:
    while not ext_flage:
    for lev3 in menu[choice][choice2]:
    print(lev3)
    choice3 = input("lev3>>:").strip()
    if len(choice3)== 0: continue
    if choice3 =="b":break
    if choice3 =="q":
    ext_flage = True
    if choice3 in menu[choice][choice2][choice3]:
    while not ext_flage:
    for lev4 in [choice][choice2][choice3]:
    print(lev4)
    choice4 = input("lev4>>:").strip()
    if len(choice4) == 0 : continue
    if choice3 == "b" :break
    if choice3 == "q" :
    ext_flage = True
                        continue

  • 相关阅读:
    错误需要理由吗?(SQL Server 不存在或访问被拒绝)
    关于权限设计的轻量级实现
    ppc通过数据线与共享电脑上网
    解读.Net中的命名空间和程序集
    .Net XML 树
    软件开发教父与国内高手论道实录全文
    企业信息化, 该怎么规划?
    ASP.NET Portal Starter Kit中的角色验证
    用js实现类似分享到显示效果
    用js实现同一个页面多个渐变效果
  • 原文地址:https://www.cnblogs.com/jack2017/p/7270503.html
Copyright © 2011-2022 走看看