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
Reviewed by CodexRitik
on
December 05, 2020
Rating:
![Nested List - Hackerrank Solution](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT-c2YJMTy15gzM_68mgjlWh8aRvW1TfvMU2hZ_RVoVJ2j3U3ve3GINiJGULOraG4GMzWbuYx720zKYrIPVk5TH8g6V9aVtjkxFEKjp3cj-DlDBF-bWIKZpjJS4sT7DPTmCINm1E02Ofc/s72-w200-c-h146/PicsArt_12-05-08.28.13%255B1%255D.jpg)
ReplyDeleteWhatever you mention about Nested list is helps me to understand the complete concept
its difficult to understand nested loop in one line.
ReplyDeleteLove quotes in Hindi