← 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))
- A.6
- B.(1, 2, 3)
- C.123
- 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 →