Discuss / Python / 交作业

交作业

Topic source

loveKD92

#1 Created at ... [Delete] [Delete and Lock User]

L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)] def by_name(t): return t[0] L2 = sorted(L,key=by_name) print(L2)

def by_score(t): return -t[1] L3 =scored(L,key=by_score) print(L3)

或者

return t[1]

L3=scored(L,key=by_score,reverse=Ture)

loveKD92

#2 Created at ... [Delete] [Delete and Lock User]

true


  • 1

Reply