Caffeinated Coder
Book an appointment
Lesson 11 · Collections and functions

Arguments: defaults, *args and **kwargs

When you call a function, Python hands each value you pass to one of its parameters. Follow one function, order(drink, size="S", *extras, **notes), through three calls and watch the values land in its boxes: by position, by name, from a default, and the leftovers packed into a tuple and a dict. Finish with the error you get when a required value is missing, and the two ordering rules Python enforces.

12 min10 steps5 questionsBeginner
Fig 11 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.