Date2

#Author:Brill
data = {"Beijing":{
    "Chaoyang":{
        "Shahe":{},"Tiantongyuan":{}
    },"Haiding":{},"Changping":{}
},"Nanjing":{"Xinjiekou":{},"Muxuyuan":{}},"Shanghai":{}}

exit_flag = False

while not exit_flag:
    for i in data:
        print(i)

    choice = input("Please enter1 :")
    if choice in data:
        while not exit_flag:
            for i2 in data[choice]:
                print("\t",i2)
            choice2 = input("Please enter2:")
            if choice2 in data[choice]:
                while not exit_flag:
                    for i3 in data[choice][choice2]:
                        print("\t\t",i3)
                    choice3 = input("Please enter3:")
                    if choice3 in data[choice][choice2]:
                        for i4 in data[choice][choice2][choice3]:
                            print("\t\t",i4)
                        choice4 = input("Please write B to back")
                        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
View Code
#Author:Brill
data = {"Beijing":{
"Chaoyang":{
"Shahe":{},"Tiantongyuan":{}
},"Haiding":{},"Changping":{}
},"Nanjing":{"Xinjiekou":{},"Muxuyuan":{}},"Shanghai":{}}

exit_flag = False

while not exit_flag:
for i in data:
print(i)

choice = input("Please enter1 :")
if choice in data:
while not exit_flag:
for i2 in data[choice]:
print("\t",i2)
choice2 = input("Please enter2:")
if choice2 in data[choice]:
while not exit_flag:
for i3 in data[choice][choice2]:
print("\t\t",i3)
choice3 = input("Please enter3:")
if choice3 in data[choice][choice2]:
for i4 in data[choice][choice2][choice3]:
print("\t\t",i4)
choice4 = input("Please write B to back")
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







猜你喜欢

转载自www.cnblogs.com/genghenggao/p/9025075.html