Skip to content

Argument

In one line

An argument is the actual value passed to a function when calling it, filling the function's parameters.

In simple words

An argument is the concrete value you pass to a function when calling it. In add(3, 5), the numbers 3 and 5 are arguments. They fill the function's parameters.

Python supports several types of arguments:

  • Positional arguments — matched by position: add(3, 5)
  • Keyword arguments — matched by name: add(a=3, b=5)
  • Default arguments — used when not provided: def greet(name='World')
  • *args — collects extra positional arguments into a tuple
  • **kwargs — collects extra keyword arguments into a dict

The distinction: parameters are the names in the definition; arguments are the values in the call.

Example

python
def func(a, b=10, *args, **kwargs):
    print(a, b, args, kwargs)

func(1)                    # 1 10 () {}
func(1, 2)                 # 1 2 () {}
func(1, 2, 3, 4)           # 1 2 (3, 4) {}
func(1, 2, x=100, y=200)   # 1 2 () {'x': 100, 'y': 200}

Arguments can be positional, keyword, default, *args (extra positional), or **kwargs (extra keyword).

Common confusions

  • Confused with: parameter

    The difference: An argument is the value passed when calling a function. A parameter is the variable name in the function definition that receives the argument. Arguments are concrete; parameters are placeholders.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary