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.
Mostly the same approach but chose tuples and explicitly sorting by name.
if name == 'main':
students = []
for _ in range(int(input())):
students.append((input(), float(input())))
# Second highest score
s2 = sorted(list(set([x[1] for x in students])))[1]
# Sort by name
students.sort(key = lambda x: x[0])
[print(s) for s,x in students if x == s2]
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 →
Mostly the same approach but chose tuples and explicitly sorting by name.
if name == 'main':