Python - What is the output: Unpacking arguments ?

Question

What is the output of the following code?

def func(a, b, c=3, d=4): print(a, b, c, d) 

func(1, *(5, 6)) 


Click to view the answer

1 5 6 4

Note

the 1 matches a by position, 5 and 6 match b and c by *name positionals.

6 overrides c's default, and d defaults to 4 because it was not passed a value.

Related Quiz