题解 | #成绩排序#

成绩排序

https://www.nowcoder.com/practice/8e400fd9905747e4acc2aeed7240978b

num=int(input())
order=int(input())
if order==0:
    order=1
elif order==1:
    order=0
    
list1=[]
for i in range(num):
    tuple1=tuple(input().split())
    list1.append(tuple1)
list1=list(sorted(list1,key=lambda x:int(x[1]),reverse=order))
for i,j in list1:
    print (i,j,sep=' ')
	#学会使用列表-元组结构

全部评论

相关推荐

安静的鲸鱼offer...:神仙级别hr,可遇不可求,甚至他可能也是突然有感而发。只能说遇上是件幸事。
秋招开始捡漏了吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务