📜  pthon 中的嵌套列表 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:48.404000             🧑  作者: Mango

代码示例1
n=int(input())
res=[]
grade=[]
for i in range(n):
    name=input()
    mark=float(input())
    res.append([name,mark])
    grade.append(mark)   #calculation 2nd lowest
#print(res)   
#print(grade)
grade=sorted(set(grade))  #sorted unique
#print(grade)
m=grade[1]
#print(m)
name=[]
for val in res:
    if m==val[1]:
        name.append(val[0])
#print(name)   #unsorted     
name.sort()
#print(name)   #sorted
for nm in name:
    print(nm)