Parameter
In one line
A parameter is a named variable in a function definition that receives a value (argument) when the function is called.
In simple words
A parameter is a placeholder in a function definition. When you write def add(a, b):, a and b are parameters — they are names that will hold the values passed when the function is called.
Parameters can have default values: def greet(name='World'). If the caller doesn't provide a value, the default is used. Parameters can also be positional or keyword (named) when calling.
The distinction between parameter and argument is: parameters are in the definition, arguments are the actual values passed in the call. This distinction is often blurred in casual usage.
Example
# Parameters: a, b (in the definition)
def add(a, b):
return a + b
# Arguments: 3, 5 (in the call)
result = add(3, 5)
print(result) # 8Parameters (a, b) are defined in the function signature. Arguments (3, 5) are the values passed when calling.
Common confusions
Confused with: argument
The difference: A parameter is a variable in the function definition. An argument is the actual value passed to the function when calling it. Parameters are placeholders; arguments are concrete values.
Related terms
Related Resources
Related Lessons
- Functions
Function parameters.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.