We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# N # n, g# [[n1,g1], [n2, g2], ...]# sort by g: sorted_grade[]# return sorted arr[n1, ..., nx] where g == sorted_grade[1]N=int(input())grades=[]students=[]foriinrange(N):name=str(input())grade=float(input())grades.append(grade)students.append([name,grade])names=[]sorted_grades=sorted(set(grades))forstudentinstudents:ifstudent[1]==sorted_grades[1]:names.append(student[0])# print(names)res=sorted(names)# print(res)fornameinres:print(name)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Nested Lists
You are viewing a single comment's thread. Return to all comments →