python制作一个菜单_python学习,day1作业:设计一个三级菜单

1 #coding=utf-8

2 #Author: RyAn Bi

3 data ={4 'beijing':{5 'changping':{6 'wudaokou':['oldboy','test'],7 'sanlitun':['oldboy','test'],8 'wangjing':['oldboy','test']9 },10 'dongcheng':{11 'wudaokou':['oldboy','test'],12 'sanlitun':['oldboy','test'],13 'wangjing':['oldboy','test']14 },15 'xicheng':{16 'wudaokou':['oldboy','test'],17 'sanlitun':['oldboy','test'],18 'wangjing':['oldboy','test']19 }20 },21 'henan':{22 'zhengzhou':{23 'wudaokou':[],24 'sanlitun':[],25 'wangjing':[]26 },27 'xuchang':{28 'wudaokou':[],29 'sanlitun':[],30 'wangjing':[]31 },32 'lohe':{33 'wudaokou':[],34 'sanlitun':[],35 'wangjing':[]36 }37 },38 'shandoong':{39 'jinan':{40 'wudaokou':[],41 'sanlitun':[],42 'wangjing':[]43 },44 'qingdao':{45 'wudaokou':[],46 'sanlitun':[],47 'wangjing':[]48 },49 'weihai':{50 'wudaokou':[],51 'sanlitun':[],52 'wangjing':[]53 }54 }55 }56

57 #print( data)

58 exit_flag =False59

60 while notexit_flag:61 for i indata:62 print(i)63 chose1 = input('where is your home:')64 if chose1 indata:65 while notexit_flag:66 for i2 indata[chose1]:67 print(i2)68 chose2 = input('where is your home:')69 if chose2 indata[chose1]:70 while notexit_flag:71 for i3 indata[chose1][chose2]:72 print(i3)73 chose3 = input('where is your home:')74 if chose3 indata[chose1][chose2]:75 while notexit_flag:76 for i4 indata[chose1][chose2][chose3]:77 print(i4)78 chose4 = input('push q come back')79 if chose4 == 'b':80 break

81 elif chose4 =='q':82 exit_flag =True83 if chose3 == 'b':84 break

85 elif chose3 =='q':86 exit_flag =True87 if chose2 == 'b':88 break

89 elif chose2 =='q':90 exit_flag = True

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值