hacker rank python(Nested Lists)solution

Nested Lists


n = int(input())
students = []

for i in range(n):
    name = input()
    mark = input()
    students.append([name, float(mark)])
   
# Getting the marks [sorted]
second_lowest = sorted( set([students[i][1] for i in range(n)]))[1]

# Getting the persons who got the second lowest mark
students_second_lowest = sorted([student[0] for student in students if student[1] == second_lowest])

for student in students_second_lowest:
    print(student)

Compiler Message
Success
Input (stdin)Download
4
Prashant
32
Pallavi
36
Dheeraj
39
Shivam
40
Expected OutputDownload
Pallavi

Comments

Popular posts from this blog

Amazon Web Services

Hacker Rank all java and python problem solutions

Testing tools for React Apps