SQLDAXExcelPython
Leaderboard
Core PythonEasy10 points

Second largest number

Complete second_largest(numbers) so it returns the second largest distinct value. In [5, 5, 3] that is 3.

How your answer is tested

After your code, this runs and its result is checked:

result = [second_largest([5, 5, 3]), second_largest([1, 2, 3, 4]), second_largest([-1, -5, -3])]
Show solutionLifetime

Real Python running in your browser through Pyodide, with pandas available. Nothing you type is sent to a server unless you save a score.

Python
Loading editor…

Press Ctrl+Enter or Run to see the result here.