✦ Python Foundations Functions module

Concept 16 · Parameters & Arguments

Give functions input.
Use arguments when calling.

Parameters let one function perform the same action with different input values. Each call supplies the values that function needs at that moment.

01 Learn02 Try03 Predict

Learning as a guest

Learning as a guest? Save your progress!

Create a free account to learn with Sloby AI, check your understanding, and track your progress.

The entire platform is free throughout 2026. Foundations stays free forever.

Give one reusable action the input it needs.

Concept 15 showed a function that always did the same thing. Parameters solve the next problem: one function can perform the same action with different values supplied at each call.

def greet(name):
    print("Hello,", name)

greet("Ana")
greet("Marko")
greet("Jelena")

A parameter is the name inside a function definition for an incoming value. In def greet(name):, name is a parameter. An argument is the actual value supplied at a call. In greet("Ana"), "Ana" is an argument. One function can therefore greet different people without copying the definition.

Use this beginner heuristic: definition → parameter; call → argument. At greet("Ana"), "Ana" is passed to name; during that call, name refers to "Ana", then the body runs using that value.

↳

One action, different input: The next call can use a different argument. At greet("Marko"), name refers to "Marko" for that call. The function definition stays the same while its result can change with the input.

Trace one call with an argument
def greet(name):
    print("Hello,", name)

greet("Ana")

Python reaches greet("Ana"), passes "Ana" to the parameter name, and runs the body. During this call, name represents "Ana", so the output is Hello, Ana. When the call ends, the function is ready to be called again with another argument.

More than one parameter
def introduce(name, city):
    print(name, "lives in", city)

introduce("Ana", "Novi Sad")

A function can need more than one incoming value. In this positional call, name receives "Ana" and city receives "Novi Sad". Arguments map to parameters by their positions.

Position changes meaning
introduce("Novi Sad", "Ana")

This is valid Python, but it gives the parameters the wrong meanings: name would receive "Novi Sad" and city would receive "Ana". Valid syntax is not always the intended result.

Arguments can be different kinds of values
def double(number):
    print(number * 2)

double(5)
double(10)

An argument does not have to be text. Here number receives a number for each call, and the same function body uses that received value to produce 10 and 20.

Read the mapping before the body
introduce("Ana", "Novi Sad")
# name ← "Ana"
# city ← "Novi Sad"

Before tracing the body, connect every argument in the call to the parameter in the matching position. Then imagine the values those parameters represent for this call.

A practical parameter-reading checklist

  1. Find the parametersLook inside the parentheses of the function definition for the names that receive input.
  2. Find the callLook inside the parentheses of the call for the actual arguments supplied.
  3. Map arguments to parametersFor an ordinary positional call, connect the first argument to the first parameter, then continue in order.
  4. Imagine the received valuesDecide what each parameter represents during this one call.
  5. Then trace the bodyRead the function body only after you know which values its parameters have.

Common beginner mistakes

  • Mixing up parameter and argumentA parameter appears in the definition; an argument is the concrete value supplied in a call.
  • Calling without a required argumentIf greet needs name, then greet() has no value to pass into that parameter.
  • Passing too many argumentsA call must supply the number of values the current function definition expects.
  • Using the wrong positional orderWith several positional arguments, Python maps values by order. Check that each value belongs with that parameter.
  • Expecting a parameter to keep a previous call’s valueEach call supplies its own arguments. Trace the values for the current call instead of carrying a value over from the last one.
  • Hard-coding one value inside the function bodyWriting one concrete name inside the body makes the function less flexible. Use the parameter when the action should work with different input.

Python Playground

Loading Python runtime…

Before running the code, predict what each call gives to the parameter. Then change an argument and add another call to see the same function work with a different value.

parameters_and_arguments.pyPython
OutputWaiting for Python
The browser runtime is loading. You can still edit the example code.

Pyodide runs Python in a browser Web Worker. It is stopped and restarted if code keeps running. Browser execution is not a complete security boundary; do not enter secrets or rely on it for untrusted code isolation.

What will this program print?

Read the function definition and each call before choosing an answer.

def introduce(name, city):
    print(name, "lives in", city)

introduce("Ana", "Novi Sad")
Choose the output
Sloby, the Python AI Tutor mascot

Your learning mentor

Sign in to ask Sloby

Create a free account or sign in to get AI guidance while you learn.

Sign in to check your understanding

Create a free account or sign in to receive AI feedback and save your learning progress.

Python AI Tutor · Learn by understanding, not just by running code.