【发布时间】:2020-01-07 18:17:25
【问题描述】:
'''
marksheet=[]
scorelist=[]
for i in range(0,int(input())):
name=input()
score=float(input())
marksheet.append([name,score])
scorelist.append(score)
second_marks=sorted(list(dict.fromkeys(score_list)))[1]# @here code is reflecing error that it list index is out of range.
对于名称,已排序的标记(mark_sheet): 如果标记 == second_lowest_mark: 打印(名称)
'''
【问题讨论】:
-
这段代码没有多大意义——请修正缩进并描述你给
input的内容(更好的是,只是对失败的数据进行硬编码)。score_list未定义。请提供minimal reproducible example。什么是预期的输出?感谢您的澄清。 -
marksheet 和 scorelist 是空列表,用户可以输入任何编号。并基于该编号,用户将输入该编号的次数名称和分数。
标签: python python-3.x list nested-lists