题解 | #成绩排序#

成绩排序

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

num_total = int(input().strip()) sort_type = int(input().strip()) lis_res = [] for i in range(num_total): a_key,b_value = map(str,input().strip().split()) lis_res.append([a_key,int(b_value)])############要考虑到重名的同学 if sort_type == 0: lis_res.sort(key =lambda x:x[1],reverse= True) for x in lis_res: print(x[0],x[1]) if sort_type == 1: lis_res.sort(key =lambda x:x[1]) for x in lis_res: print(x[0],x[1])

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 12:10
点赞 评论 收藏
分享
06-28 22:48
已编辑
广东金融学院 Java
小浪_Coding:学院本+这俩项目不是buff叠满了嘛
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 12:23
转人工😡
门口唉提是地铁杀:五次握手了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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