🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Scope and Closures: all 10 questions

Quiz: Scope and Closures · Question 9 of 10

What does this print? (code)

What does this print?

def add(a, b, c):
    return a + b + c
nums = (1, 2, 3)
print(add(*nums))
  1. A.6
  2. B.(1, 2, 3)
  3. C.123
  4. D.An error
Answer & explanation

Correct answer: 6

*nums spreads the tuple into three positional arguments.

Can you get the rest right without peeking?

Take the timed Quiz: Scope and Closures quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →