← WA Computer Science ATAR Unit 1

Parameters versus arguments

The name in a function definition that receives a value, like name in def greet(name). The value passed in the call, like greet('Ava'), is the argument.

Understanding Parameters versus arguments in WA Computer Science ATAR Unit 1

What it does: Writing parameter=value in the call is a keyword argument. Python matches by name, so height can come before width. The function has two parameters, so the call supplies two arguments, one for name and one for town. An argument is the actual value passed in when the function is called. Positional arguments match by order. a gets 10 and b gets 3, so the result is 10 - 3 = 7. With positional arguments the first value goes to the first parameter, the second to the second, and so on. Names listed in the brackets of a def line are parameters. They act as placeholders until the function is called.

Common mistakes: The function has one parameter, name, so the call must pass one argument. greet() passes none and causes a TypeError. It should be greet('Ava'). The parameters are w and h. The name height does not exist inside the function, so Python raises a NameError. It should be return w * h.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 100–314) and word search (Modules 100–470).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
In def greet(name):, what is name?
A parameterAn argument
Matches
def total(a, b): return a + b total(4)
↓
The function has two parameters but the call gives only one argument, so Python raises a TypeError for the missing argument b.
Applying
Meanings
Term
parameter
Meaning
The name in a function definition that receives a value, like name in def greet(name). The value passed in the call, like greet('Ava'), is the argument.
Practice
def greet(name, year):
Testing
Gaps
def greet():
Check Answer
Spots
2 print('Hi', name)
3greet()

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Moray Eel' badge — Lurking Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. In def greet(name):, what is name?
A. An argument
B. A parameter ✓
A parameter is the name listed in the function definition. It receives a value when the function is called.
2. In the call greet('Ava'), what is 'Ava'?
A. An argument ✓
B. A parameter
An argument is the actual value passed in when the function is called.
3. Which statement is correct?
A. Arguments appear in the definition, parameters appear in the call
B. Parameters appear in the definition, arguments appear in the call ✓
The def line lists parameters. The call supplies arguments to fill them.
4. Given def area(w, h):, which call passes the right number of arguments?
A. area(4, 5) ✓
B. area(4)
area has two parameters, so a call needs two arguments (unless a default is set). area(4) causes a TypeError.
5. Given def sub(a, b): return a - b, what does sub(10, 3) return?
A. 7 ✓
B. -7
Positional arguments match by order. a gets 10 and b gets 3, so the result is 10 - 3 = 7.

Match the Pairs

def area(width, height): → width and height are parameters: names in the definition that will receive values
area(5, 3) → 5 and 3 are arguments: the actual values passed in the call, matched by position
A keyword argument names the parameter it is giving a value to, so the order does not matter → area(height=3, width=5)
The number of arguments in a call must match the number of parameters in the definition (unless defaults are set) → def greet(name, town): greet('Ava', 'Perth')
def total(a, b): return a + b total(4) → The function has two parameters but the call gives only one argument, so Python raises a TypeError for the missing argument b.
def info(name, age): print(name, age) info(16, 'Zoe') → The positional arguments are in the wrong order, so name receives 16 and age receives 'Zoe'.

Key Term

parameter
The name in a function definition that receives a value, like name in def greet(name). The value passed in the call, like greet('Ava'), is the argument.

Fill in the Blanks

1. def greet(name): print('Hello, ' + name)
Hint: Type the parameter name that the function body uses.
2. def area(w, h): return w * h print(area(w=4, h=5))
Hint: Type the parameter name used as a keyword in the call.
3. def sub(a, b): return a - b print(sub(10, 4)) # 6
Hint: Type the first argument; positional order means it fills a, and the result shown in the comment tells you its value.
4. def intro(name, age): print(name, age) intro('Ava', 16)
Hint: Type the second parameter name that the body prints, so it can receive the second argument.
5. def greet(name): print('Hi ' + name) greet(name='Ava')
Hint: Type the symbol that joins a keyword argument's name to its value.

Spot the Error

Question 1
A def greet(name):
B print('Hi', name)
C greet()
Line C — The function has one parameter, name, so the call must pass one argument. greet() passes none and causes a TypeError. It should be greet('Ava').
Question 2
A def area(w, h):
B return w * height
C print(area(3, 4))
Line B — The parameters are w and h. The name height does not exist inside the function, so Python raises a NameError. It should be return w * h.
Question 3
A # show one student
B def show(name mark):
C print(name, mark)
D show('Ava', 90)
Line B — Parameters in a function definition must be separated by commas. It should be def show(name, mark):.
Question 4
A def box(w, h):
B return w * h
C print(box(h=2, 5))
Line C — A positional argument cannot come after a keyword argument, which is a SyntaxError. Either name both, as in box(h=2, w=5), or use positions only, as in box(5, 2).
Question 5
A def add(2, 3):
B return a + b
C print(add(2, 3))
Line A — A definition lists parameter names, not values. Values such as 2 and 3 are arguments and belong in the call. It should be def add(a, b):.

Student with a class code? Join your class →