Brainlag
  1. Python
  2. Core
15/42 lessons

Parameters, defaults and scope

25 min6 exercisesPremium

Python function parameters in depth: default values, keyword arguments, returning several values, and how local and global scope decide which variable you get.

The skill
Use defaults, keyword arguments and several return values, and keep variables where they belong.
You make
A greeting, a shipping calculator and a loot splitter for a game guild.

Premium lesson

£7.99 a month or £59 a year. Cancel any time.

Builds on 14 Functions, and return vs print. Free to try: Python Foundations and the playground.

Step 1 of 10
exercise_1.py

You've reached the good stuff.

6 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.

Python 3.13