Python Quest

Track 5 · Lesson 4 of 12

Default and keyword arguments

Make parameters optional with default values, pass arguments by name, and avoid the mutable default trap.

About 35 minBeginner4 exercises

You will be able to

  • Give parameters default values so callers can leave them out
  • Pass arguments by name with keyword arguments, in any order
  • Combine positional and keyword arguments correctly
  • Explain why a list as a default value is shared between calls, and fix it with None

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.