題解 | #成績(jī)排序#
成績(jī)排序
http://fangfengwang8.cn/practice/3f27a0a5a59643a8abf0140b9a8cf1f7
n = int(input()) stu = [] for i in range(n): a, b = map(int, input().split(" ")) stu.append((a, b)) stu.sort(key=lambda x: (x[1], x[0]))#sort內(nèi)置是可以用元組排序的 for x in stu: print(x[0], end=" ") print(x[1])