关于作者

Discuss / Python / 我怎么觉得第一道题是多次一举呢

我怎么觉得第一道题是多次一举呢

问题来源

变幻的世界观

#1 Created at ...

直接进行sorted排序也是按照名字来的吧,我试了一下是A-Z的顺序,如果想按照Z-A的顺序,直接加个reverse = True不就好了么。函数用不着啊

变幻的世界观

#2 Created at ...

第二题

-- coding: utf-8 --

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

def by_score(t): return t[-1] L2 = sorted(L, key=by_score)

print(L2)


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.