首页 > 编程语言 > 详细

武佩奇python数据类型的两个题目:

时间:2020-11-25 12:20:57      阅读:25      评论:0      收藏:0      [点我收藏+]
#一个令人cao蛋的查询题目:
# li = []
# go = True
# while go:
#     for i,v in enumerate(dic,1):
#         print(i,v)
#         li.append(v)
#     u_c = str(input(">>>1,2,查看,i添加"))#1
#     if u_c.isdigit():
#         u_c = int(u_c)
#         li1 = []
#         while go:
#             for i,v in enumerate(dic[li[u_c-1]],1):
#                 print(i,v)
#                 li1.append(v)
#             u_c1 = input(">>>>")
#             u_c1 = int(u_c1)
#             while go:
#                 for i in dic[li[u_c-1]][li1[u_c1-1]]:
#                     print(i)
#                 # v = input("请输入")
#                 u_c5 = str(input(">>>>>q,退出,b返回"))
#                 u_c5 = u_c5.lower()
#                 if u_c5 == "b":
#                     li1.clear()
#                     # del li1[:]
#                     break
#                 elif u_c5 == "q":
#                     go = False
#                     break
#     elif u_c.isalpha():
#         u_c == u_c.lower()
#         if u_c == "i":
#             lx = input("类型:")
#             if dic.get(lx,1) == 1:
#                 dic[lx] = {}
#             zl = input("种类:")
#             if dic[lx].get(zl,1) == 1:
#                 dic[lx][zl] = []
#             while True:
#                 mc = input("名称:")
#                 if mc == "q":
#                     li.clear()#一进程序打印第一次,返回的时候clear
#                     break
#                 if mc in dic[lx][zl]:
#                     print("fuck")
#                 else:
#                     dic[lx][zl].append(mc)

# db = {
#     "北京":{
#             "昌平":{
#                     "沙河":{},
#                     "回龙观":{}
#                     },
#             "朝阳":{},
#             "海淀":{}
#             },
#     "上海":{}
# }
# path = []
# while True:
#     temp = db
#     for item in path:
#         temp = temp[item]
#     print("节点:",list(temp.keys()))
#     # db[input(">>>")] = {}
#     # print(db)
#     u_c = input("1,添加,2,查看,(b,q),退出,返回>>>")
#     if u_c == ‘1‘:
#         name = input("请添加>>>")
#         temp[name] = {}
#     elif u_c == ‘2‘:
#         name = input("查看>>>")
#         path.append(name)
#     elif u_c.lower() == ‘b‘:
#         if path:
#             path.pop()
#     elif u_c.lower() == ‘q‘:
#         break
#     else:
#         print("Error")

# db = {
#     "北京":{
#             "昌平":{
#                     "沙河":{},
#                     "回龙观":{}
#                     },
#             "朝阳":{},
#             "海淀":{}
#             },
#     "上海":{}
# }
# path = []
# while True:
#     temp = db
#     for item in path:
#         temp = temp[item]
#     print(list(temp.keys()))
#     u_c = input("1添加,2查看,(b,q)返回,退出>>>")
#     if u_c == ‘1‘:
#         v = input("请添加节点>>>>")
#         if v in temp:
#             print("节点以存在")
#         else:
#             temp[v] = {}
#     elif u_c == ‘2‘:
#         v = input("请输入查看节点>>>>")
#         if v in temp:
#             path.append(v)
#         else:
#             print("不存在该节点")
#     elif u_c.lower() == ‘b‘:
#         path.pop()
#     elif u_c.lower() == ‘q‘:
#         break
#     else:
#         print("Error")



武佩奇python数据类型的两个题目:

原文:https://www.cnblogs.com/Edendd/p/14034361.html

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