zoukankan      html  css  js  c++  java
  • python: practice three-level manu

    menu={'china':{'jx_province':{'sr_manicipality':{'yiyang_country':['qinghu_town','guifeng_town','wangli_town']},},},

    'American':{'wathton.dc':{'ei':{'mi':['dei','dei','bue']},},},

    'Britian':{'london':{'ei':{'mi':['dei','dei','bue']},},},

    'Rusian':{'mosque':{'ei':{'mi':['dei','dei','bue']}}}

    }

    back_flag=False

    exit_flag=False

    while not back_flag and not exit_flag:
    for key,v in enumerate(menu,1):

    print(key,v)

    choice=input('>>:').strip()

    if choice in menu:

    while not back_flag and not exit_flag:

    for key2,v2 in enumerate(menu[choice]):

    print(key2,v2)

    choice2=input('2>>:').strip()

    if choice2=='b':

    back_flag=True

    if choice2=='q':

    exit_flag=True

    break

    if choice2 in menu[choice]:

    while not back_flag and not exit_flag:

    for key3,v3 in enumerate(menu[choice][choice2]):

    print(key3,v3)

    choice3=input('3>>').strip()

    if choice3=='b':

    back_flag=True

    if choice3=='q':

    exit_flag=True

    break

    if choice3 in menu[choice][choice2]:

    for key4,v4 in enumerate(menu[choice][choice2][choice3],1):

    print(key4,v4)

    choice5=input('5>>').strip()

    print('This is last level')

    if choice5=='b':

    back_flag=True

    if choice5=='q':

    exit_flag=True

    break

    else:
    back_flag=True



    else:

    back_flag=False

    else:

    back_flag=Fals

                     

         

  • 相关阅读:
    ViewPager 滑动页(一)
    Fragment中Button的android:onClick 无法监听相应
    Button的四种Click响应方法
    环形图 自定义(一)
    Progress 自定义(一)-shape
    Button 自定义(一)-shape
    客户机页表遍历
    KVM的ept机制
    linux内核源码中两个重要的宏
    总结
  • 原文地址:https://www.cnblogs.com/alansuny/p/12442644.html
Copyright © 2011-2022 走看看