A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Function Parameters and Argument Passing

College Depth 75 in the knowledge graph ☐ I know this ☆ Set as goal
736topics build on this
325prerequisites beneath it
See this on the map →
Defining and Calling FunctionsVariables and Assignment+1 more→→Parameter Passing: Value vs. ReferenceReturn Values+1 more
functions parameters arguments

Core Idea

Parameters are variables declared in a function's signature; arguments are values passed to a function. When a function is called, arguments are bound to parameters. This mechanism allows functions to operate on different data without rewriting code.

How It's Best Learned

Write functions with one, two, and many parameters. Call functions with different argument values and observe parameter binding.

Common Misconceptions

Explainer

You already know how to define and call functions — you can write `def greet():` and invoke it with `greet()`. But functions become truly powerful when they can accept input that changes their behavior. Instead of writing a separate function for every greeting, you write `def greet(name):` and pass different names each time. The variable `name` in the function signature is a parameter — a placeholder that receives a value when the function is called. The value you pass in — like `greet("Alice")` — is the argument. The parameter gets bound to the argument's value at call time, and within the function body, you use the parameter just like any other variable.

Functions can take multiple parameters, separated by commas: `def add(a, b):` defines a function that expects two arguments. When you call `add(3, 7)`, the argument `3` is bound to parameter `a` and `7` is bound to parameter `b`. The order matters — the first argument goes to the first parameter, the second to the second, and so on. This is called positional argument passing. Many languages also support keyword arguments (or named arguments), where you specify which parameter gets which value explicitly: `add(b=7, a=3)`. This is especially useful when a function has many parameters and you want clarity, or when you want to skip parameters that have default values.

Default parameter values let you make some arguments optional. In `def greet(name, greeting="Hello"):`, the second parameter has a default. Calling `greet("Alice")` uses the default greeting; calling `greet("Alice", "Hey")` overrides it. This pattern is ubiquitous — it lets you keep simple calls simple while allowing customization when needed. The parameters with defaults must come after those without, so the function signature reads left-to-right from required to optional.

One subtle but important point is what happens when you modify a parameter inside a function. For simple types like numbers and strings, changing the parameter does not affect the original variable outside the function — the parameter is effectively a local copy. But for mutable objects like lists and dictionaries, the parameter refers to the *same object* in memory. If you call `def append_item(lst): lst.append(42)` with `append_item(my_list)`, `my_list` itself is modified. This is the difference between pass-by-value (copying the value) and pass-by-reference (sharing the object). Python technically uses "pass-by-object-reference" — the parameter and the argument point to the same object, but reassigning the parameter (`lst = []`) only changes the local variable, not the caller's. Understanding this distinction prevents a whole class of bugs where functions unexpectedly modify — or unexpectedly fail to modify — the data you pass to them.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Conditional Statements → Defining and Calling Functions → Functions: Decomposing Problems → Function Parameters and Argument Passing

Longest path: 76 steps · 325 total prerequisite topics

Prerequisites (3)

Leads To (3)