Parameters, local and global variables

About this lesson: Parameters, local and global variables

In short

Parameters are placeholders in a subroutine; arguments are the actual values passed. Change the arguments.

Parameters, local and global variables

What you'll explore

Parameters: Passing values in
Parameters are placeholders in a subroutine; arguments are the actual values passed. Change the arguments.
Scope: Local and global
Local variables exist only inside a subroutine; global variables can be used anywhere. Step through.
Tracing calls: Jump in and back
Trace a program that calls a subroutine with parameters.
Check yourself: Scope
A variable is declared inside a procedure.

Also in this lesson

  • Step by step
  • Watch out for these
  • More than the lesson
  • Stretch your brain
  • Try it yourself

Words to know

Parameter
Placeholder for a value passed into a subroutine.
Argument
The actual value passed.
Local variable
Exists only within a subroutine.
Global variable
Can be used anywhere.
Scope
Where a variable can be used.

Sources

  • Python documentation: scopes and namespaces
  • Raspberry Pi Foundation, Isaac Computer Science: scope
  • BBC Bitesize, GCSE Computer Science: local and global variables
  • Khan Academy: functions with parameters

An interactive lesson with a live experiment: move the sliders, press the buttons and answer quick questions. 4 short steps and a 8-question quiz. Part of the Family plan. Written and checked by Shalo Lab. Last updated 11 November 2026.

← Procedures and functions · Library routines →

All lessons in Term 1 · Computing · Age 15