Python Quest

Track 5 · Lesson 9 of 12

Any number of arguments: *args and **kwargs

Accept any number of positional arguments with *args and named arguments with **kwargs, and unpack lists and dictionaries into calls.

About 35 minIntermediate4 exercises

You will be able to

  • Write a function that accepts any number of positional arguments with *args
  • Write a function that accepts any number of keyword arguments with **kwargs
  • Combine regular parameters, *args, keyword-only parameters and **kwargs in the right order
  • Unpack a list into positional arguments with * and a dictionary into keyword arguments with **

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.