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.
Correct, that line of code is sorting all the unique marks (scores), and grabbing the second from the bottom ([1]). It's slightly confusing because he named the variable second_highest, when it's really the second lowest score. The reason for using set is to guard against the case where more than one student is tied for the lowest score.
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 →
Correct, that line of code is sorting all the unique marks (scores), and grabbing the second from the bottom (
[1]
). It's slightly confusing because he named the variablesecond_highest
, when it's really the second lowest score. The reason for usingset
is to guard against the case where more than one student is tied for the lowest score.