Parameter vs Argument: Does the GCSE Exam Distinguish Them?
Learn the difference between parameters and arguments in AQA GCSE Computer Science, with a simple code example and guidance on how to describe them in an exam.
A parameter is a named placeholder in a subroutineβs definition. An argument is the value supplied for that parameter when the subroutine is called. For AQA GCSE Computer Science, learn the distinction, but do not assume an exam question will ask you to define both words directly.
See the difference
def greet(name):
print("Hello, " + name)
greet("Sam")
Here, name is the parameter: it appears where greet is defined. "Sam" is the argument: it is supplied in the call to greet. When the call runs, the argument gives the parameter its value, so the program prints Hello, Sam.
A subroutine is a named section of code that can be called to carry out a task. Parameters let the same subroutine work with different data each time. For example, calling greet("Alex") uses the same code but supplies a different argument.
An argument can also be a variable rather than a fixed piece of text. If you write student = "Alex" and then call greet(student), student is the argument in that call. name remains the parameter in the definition. The value passed to the subroutine is "Alex". Look at where each name appears in the code.
What about the exam?
The useful exam skill is to recognise what is being defined and what is being passed in a call, especially when tracing code or explaining how a subroutine works. If a question asks for a parameter, point to the name in the subroutine definition. If it asks for an argument, point to the value or variable supplied at the call. Follow the wording and context of the question; there is no need to guess whether a particular terminology question will appear.
A common mistake is to say that name and "Sam" are both parameters. They are connected, but they play different roles: the parameter receives; the argument is supplied.