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.

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