Second Largest
Medium · 50 XPPrint the second-largest distinct value in the starter list.
Target output
23
Blank · autosaved
PYsecond-largest.py
Deduplicate with set(), sort, take index [-2].
nums = [17, 42, 8, 42, 23, 4, 23] print(sorted(set(nums))[-2])
Run your code to check it…