>>> students=[('john','A',15),('jane','B',12),('dave','B','10')]>>> sorted(students,key=lambda s:s[2])
[('jane', 'B', 12), ('john', 'A', 15), ('dave', 'B', '10')]>>> sorted(students,key=lambda s:s[2])
[('jane', 'B', 12), ('john', 'A', 15), ('dave', 'B', '10')]>>> sorted(students,key=lambda s:s[2],reverse=True)
[('dave', 'B', '10'), ('john', 'A', 15), ('jane', 'B', 12)]>>> sorted(students, key=lambda s: s[2], reverse=True)
[('dave', 'B', '10'), ('john', 'A', 15), ('jane', 'B', 12)]>>> students = [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]>>> sorted(students, key=lambda s: s[2])
[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]>>> sorted(students, key=lambda s: s[2], reverse=True)
[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]### 题目描述
题目来源及自己的思路
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
你期待的结果是什么?实际看到的错误信息又是什么?