Nested List - Hackerrank Solution

 

Nested List


Objective:


Given the names and grades for each student in a class of N students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade.

Note: If there are multiple students with the second lowest grade, order their names alphabetically and print each name on a new line.


Solution:

L=[[input(),float(input())] for i in range(int(input()))]
s = sorted(set([i[1] for i in L]))
for name in sorted(i[0] for i in L if i[1] == s[1]):
    print(name)



Note:

This Code is Verified by all Test Cases.If any error occurs then Comment correct code Below in comment box.

Disclaimer:-

The above hole problem statement is given by hackerrank.com, but the solution is generated by the CodexRitik . if any of the query regarding this post or website fill the following contact form Thank You.

Nested List - Hackerrank Solution Nested List - Hackerrank Solution Reviewed by CodexRitik on December 05, 2020 Rating: 5

2 comments:

Powered by Blogger.