首页 > 18号美团笔试,求大佬看看为什么OLE了
头像
我不知道啊?
编辑于 2021-04-18 14:07
+ 关注

18号美团笔试,求大佬看看为什么OLE了

第一次做编程笔试,非科班菜鸡,求大佬看看,在本地编译器用例算出来的是对的,但是运行就OLE
def news(x,y,news_list):
if not news_list.get(x):
news_list[x]=y
else:
news_list[x]+=y
def query(news_list): news_list=sorted(news_list.items(),key=lambda item:item[1],reverse=True)
index=[x[0] for x in news_list] return print(index)

news_list=dict()
while 1:
s = input()
a=[]
if s != "":
for x in s.split():
a.append(x)
if len(a)==1 and a[0]=="query":
query(news_list)
elif len(a)==3:
x=int(a[1])
y=int(a[2])
if not news_list.get(x): news_list[x]=y
else:
news_list[x]+=y

全部评论

(7) 回帖
加载中...
话题 回帖

相关热帖

近期热帖

历年真题 真题热练榜 24小时
技术(软件)/信息技术类
查看全部

热门推荐