🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Interview Programs: all 13 questions

Quiz: Python Interview Programs · Question 8 of 13

What does this print? (code)

What does this print?

nums = [3, 7, 1, 9, 4]
print(sorted(set(nums))[-2])
  1. A.7
  2. B.9
  3. C.4
  4. D.An error
Answer & explanation

Correct answer: 7

The second largest unique value.

Can you get the rest right without peeking?

Take the timed Quiz: Python Interview Programs quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →