首页 > 代码库 > python day-2 三级目录作业

python day-2 三级目录作业

zone = {
"广东":{ "广州":{ "天河":["天河体育馆","暨南大学"],
"越秀":["越秀公园","五羊"]
},
"深圳":{ "福田":["市民中心","平安大厦"],
"南山":["腾讯","世界之窗"]
}
},
"湖北":{ "武汉":{ "武昌":["武汉大学","华科大"],
"汉口":["汉正街","火车站"]
},
"鄂州":{ "鄂城":["武商","西山"],
"葛店":["开发区","电厂"]
}
}
}
exit_flag = False
while not exit_flag:
for i in zone:
print(i)
choice = input("请选择:")
if choice in zone :
while not exit_flag:
for i2 in zone[choice]:
print(i2)
choice2 = input("请选择2:")
if choice2 in zone[choice]:
while not exit_flag:
for i3 in zone[choice][choice2]:
print(i3)
choice3 = input("请选择3:")
if choice3 in zone[choice][choice2]:
for i4 in zone[choice][choice2][choice3]:
print(i4)
choice4 = input("最后一级,请按b返回")
if choice4 == "b" :
pass
elif choice4 == "q":
exit_flag = True
if choice3 == "b" :
break
elif choice3 == "q" :
exit_flag = True
if choice2 == "b":
break
elif choice2 == "q":
exit_flag = True
elif choice == "q" :
break

python day-2 三级目录作业