HackerRank Python

Nested Lists

alpha
beta
  • 2 ≤ N ≤ 5
  • There will always be one or more students having the second lowest grade.
5
Harry
37.21
Berry
37.21
Tina
37.2
Akriti
41
Harsh
39
Berry
Harry
if __name__ == '__main__':n = int(input())marksheet = [[input(), float(input())] for _ in range(n)]second_highest = sorted(list(set([marks for name, marks in marksheet])))[1]print('\n'.join([a for a, b in sorted(marksheet) if b == second_highest]))

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store