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

  • 相关阅读:
    10个超实用的PHP代码片段
    MySQL支撑百万级流量高并发的网站部署详解
    程序员总结:帮助你早些明白一些道理
    50个最常用的UNIX / Linux命令(结合实例)
    php.ini 核心配置选项说明
    智能指针的死穴 循环引用
    滥用vector带来的瓶颈
    JS——层的遮罩效果
    【趣】无广告看视频
    【SQLServer】远程访问数据库进行配置
  • 原文地址:https://www.cnblogs.com/jack2017/p/7270503.html
Copyright © 2011-2022 走看看