從鍵盤輸入10個學生的成績並儲存在列表中,求成績最高者的序號和成績
阿新 • • 發佈:2019-01-23
解決了最後一對無法輸出
解決了多個最大成績輸出錯位
縮減了不必要的程式碼
ls=[]
j=[]
k=[]
for c in range(11):
xh=int(input(''))
fen=int(input(''))
i=[]
i.append(xh)
i.append(fen)
ls.append(i)
print("number mark",sep="\t")
for s in ls:
j.append(s[1])
k.append(s[0])
t=max(j)
n=j.count(t)
s=0
for l in range(n):
f=j.index(t)
print (k[f+s],t,sep="\t")
j.remove(t)
s+=1
