题解 | 成绩排序

成绩排序

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

all = int(input())

reseond = int(input())
arr = []
for i in range(all):
    temp = input().split()
    arr.append(temp)

if reseond == 0:
	#注意排序进制转int 如果是字符串会默认排序 按照字符串的首字母
    for i in sorted(arr, key=lambda x: int(x[1]), reverse=True):
        print(i[0] + " " + i[1])
else:
    for i in sorted(arr, key=lambda x: int(x[1])):
        print(i[0] + " " + i[1])

全部评论

相关推荐

神哥不得了:神哥来啦~自我评价和校园经历的话可以直接删了,从大厂暑期的话应该没有什么太多问题,应该是能拿到很多大厂面试机会的,就是在面试的时候表示的好一点就行,可以在面试前先把高频top 50的八股多巩固几遍,千万不要看那些假高频八股,这两个项目的话问题不是很大,应该能够帮你找到大厂实习的,算法的话一定要刷起来,因为大厂有些还是比较看重算法的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
牛客网
牛客企业服务