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.
Such code pieces are too hard for debbuging and maintaining, here is my edit of your code for minimal readability:
marksheet = []
noStudents = int(input())
for _ in range(noStudents):
name = input()
score = float(input())
marksheet.extend([[name, score]])
uniqueOrderedMarks = sorted(list(set([marks for _, marks in marksheet])))
second_highest = uniqueOrderedMarks[1]
print('\n'.join([name for [name, score] in sorted(marksheet) if score == second_highest]))
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 →
Such code pieces are too hard for debbuging and maintaining, here is my edit of your code for minimal readability: