You are viewing a single comment's thread. Return to all comments →
You can try it! :)
nums = [1, 2, 2] print sorted(list(set(nums)))[-2]
Prints '1' for me. The 'set' function returns only unique values (here, [1, 2]), and then after sorting, the second to last element is printed.
Seems like cookies are disabled on this browser, please enable them to open this website
Find the Runner-Up Score!
You are viewing a single comment's thread. Return to all comments →
You can try it! :)
Prints '1' for me. The 'set' function returns only unique values (here, [1, 2]), and then after sorting, the second to last element is printed.