Another 1 ways to implement the Python level three menu

Source: Internet
Author: User

menu = { "South China":{  "Guangdong":["Guangzhou","Foshan","Shenzhen","Dongguan"],  "Guangxi":["Nanning","Liuzhou","Guilin","Beihai"],  "Hainan":["Haikou","Sanya","three Shashi","Zhanzhou"] }, "East China":{  "Shanghai":["Huangpu District","Luwan District","Xuhui","changning","Putuo District"],  "Anhui":["Hefei","Wuhu","Huainan","Maanshan"],  "Jiangsu":["Nanjing","Wuxi","Xuzhou","Changzhou","Suzhou"] }, "North China":{  "Beijing":["Dongcheng District","Xicheng District","Chaoyang District","Fengtai District","Shijingshan District","Haidian District"],  "Shanxi":["Taiyuan City","Datong","Yangquan","Changzhi"],  "Hebei":["Shijiazhuang City","Tangshan","Qinhuangdao Shi","Xingtai"] }, "Central China":{  "Hubei":["Wuhan","Huangshi","Shiyan","Shiyan"],  "Henan":["Zhengzhou","Kaifeng","Luoyang","Pingdingshan"],  "Hunan":["Changsha","Zhuzhou","Hengyang","Shaoyang"] }, "Southwest":{  "Chongqing":["Wanxian District","Fuling District","Yuzhong District","Dadukou District"],  "Sichuan":["Chengdu City","Zigong","Panzhihua","Deyang"],  "Guizhou":["Guiyang","Liupanshui","Zunyi","Anshun"], }, "Special Administrative Region":{  "Hong Kong":["Tunmen","Bend Aberdeen","North Point","Sai Kung"],  "Macau":["Martine","St. Anthony's Parish District","Lobby Area","Wangdet"], },}
Last =[Menu]now=Menu whileTrue: forKeyinchNow :Print(key) Choice= Input ('>>>:'). Strip ()ifChoice = ='Q':         Break    ifChoice = ='b': Now= Last[-1] Last.pop ()ifChoiceinchNow:last.append (now) now= Now[choice]

Main implementation methods:

Add the current menu to the menus and then B to return to the menu to extract the menus.

Another 1 ways to implement the Python level three menu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.