Parameters are the names used for inputs when defining a function. Arguments are the values of the inputs supplied when a function is called.
To reiterate, arguments are the actual values that go into the function, such as 42.0
, "the dark knight"
, or True
. Parameters are the names we use in the function definition to refer to those values, which at the time of writing the function, can be whatever we like.
That said, this is all semantics, and frankly developers are really lazy with these definitions. You'll often hear the words "arguments" and "parameters" used interchangeably.
# a and b are parameters
def add(a, b):
return a + b
# 5 and 6 are arguments
sum = add(5, 6)
____
are the inputs specified by the function definition