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.
This solution will break with the following test case:
[['a', 1.0], ['b', 1.0], ['c', 2.0], ['d', 2.0]]
Both a and b have the lowest grade. second_lowest_grade = sorted(set(student[1] for student in students))[1]
will select [b. 1.0] which is the lowest grade still
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 →
This solution will break with the following test case:
[['a', 1.0], ['b', 1.0], ['c', 2.0], ['d', 2.0]]
Both a and b have the lowest grade. second_lowest_grade = sorted(set(student[1] for student in students))[1] will select [b. 1.0] which is the lowest grade still