Discuss / Python / 交作业

交作业

Topic source

xinyujaychou

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

L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)]

def nameSort(x) : return x[0][0].upper()

def scoreSort(x) : return 100 - x[1] print(sorted(L, key = nameSort)) print(sorted(L, key = scoreSort))


  • 1

Reply