Contents

Programming Fundamentals › Programming Basics

Parameter vs Argument

Parameters are in the definition; arguments are the values passed at the call.

Also known as: formal parameter, actual argument, parameters and arguments

Both words describe the values that flow into a function, but from two different points of view.

  • A parameter is the name listed in the function’s definition. It’s a placeholder.
  • An argument is the actual value passed in when the function is called.
def greet(name, greeting):          # name, greeting: parameters
    return f"{greeting}, {name}"

greet("Ana", "Hello")               # "Ana", "Hello": arguments

People often use the words interchangeably, and you’ll be understood. The distinction helps when reading error messages: “takes 2 positional arguments but 3 were given” is about the call.

Ways to pass arguments

greet("Ana", "Hi")                  # positional: matched by order
greet(greeting="Hi", name="Ana")    # keyword: matched by name, order doesn't matter

Keyword arguments make calls self-explanatory, especially for booleans (flag arguments).

Common errors

  • Wrong number of arguments.
  • Arguments in the wrong order (two strings swapped, and nothing complains).
  • Passing a value of the wrong type.