Guidelines

The Difference Between Parameters and Arguments

When defining and calling functions, it's easy to confuse parameters and arguments.

In this lesson, we'll take a closer look at the difference between parameters and arguments.


Parameters

Parameters refer to the variables used when defining a function.

Function Definition and Parameters Example
def add(x, y): return x + y

In the example above, x and y are parameters of the add function.

When a function is called, the parameters are initialized with the values passed, and are used within the code block.


Arguments

Arguments are the actual values passed when calling a function.

Function Definition and Parameters Example
# x, y are parameters def add(x, y): return x + y # 3, 5 are arguments result = add(3, 5) # 8 print(result)

In the code above, 3 and 5 are arguments in the call add(3, 5).

When the function is called, arguments are passed to the function's parameters and are used inside the function.

In summary, parameters are variables named during function definition for executing code, whereas arguments are the actual values passed to the function during a call.

Mission
0 / 1

Parameters refer to the actual values passed to a function.

O
X

Guidelines

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Execution Result