小列表里寫的是同學的名字和成績?
scoreList = [
['a',98],
['c',45],
['b',70],
['d',85],
['h',85],
['f',92],
['g',30],
['e',65]
];
arrLen = len(scoreList);
for i in range(arrLen):
a = scoreList[i]
for j in range(arrLen):
b = scoreList[j-1]
if b[1]<a[1]:
scoreList[i],scoreList[j-1] = scoreList[j-1],scoreList[i]
print(scoreList)