首页 > 编程语言 > 详细

python基础之作业3----三级菜单小练习

时间:2017-05-25 00:38:19      阅读:310      评论:0      收藏:0      [点我收藏+]
data = {
"华为技术":{
"产品与解决方案":{
"云核心网":{"云核心网研发管理部","云核心网平台开发部"},
"无线网络产品线":{"无线研发管理部","无线平台开发部" },
},
"2012实验室":{
"质量与运营部":{"上研质量与运营部","成研质量与运营部"},
},
"物联网":{
"车联网":{"车联网研发管理部","车联网开发管理部"},
},
},
}

exit_flag = False # 默认不退出,

while not exit_flag:
for i in data:
print(i)
user_choice = input("请选择您的一级SAP部门信息: ")
if user_choice in data:
while not exit_flag:
for j in data[user_choice]:
print("\t",j)
user_choice_2 = input("继续选择您的二级SAP信息: ")
if user_choice_2 in data[user_choice]: #[user_choice_2]:
while not exit_flag:
for k in data[user_choice][user_choice_2]:#[user_choice_3]:
print("\t\t",k)
user_choice_3 = input("继续选择您的三级SAP信息: ")
if user_choice_3 in data[user_choice][user_choice_2]:
for l in data[user_choice][user_choice_2][user_choice_3]:
print("\t\t",l)
user_choice_4 = input("达到最后一层了,返回请输入back:")
if user_choice_4 == "back":
break
elif user_choice_4 == "exit":
exit_flag = True
#pass 如果写pass,可以作为一个占位符,
if user_choice_3 == "back":
break
elif user_choice_3 == "exit":
exit_flag = True
if user_choice_2 == "back":
break
elif user_choice_2 == "exit":
exit_flag = True

elif user_choice == "exit":
exit_flag = True



python基础之作业3----三级菜单小练习

原文:http://www.cnblogs.com/y00261904--mark/p/6901611.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!