Fix the programExercise 6/6Intermediate30 XP
The second largest value
Task
The function druhe_najvacsie(cisla) should return the second largest distinct value in the list (the list has at least two distinct values). For [5, 5, 3] it should return 3, but it returns 5. Fix it.
Examples
Call
print(druhe_najvacsie([1, 4, 2]))
Expected output
2
Call
print(druhe_najvacsie([5, 5, 3]))
Expected output
3
After you submit, 2 hidden tests will also check your solution: many equal values, negative numbers.
You need to know
Python starts the first time you run code.
Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.
Input (stdin)
Each line = one call to input().
Output
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.