Skip to content

Function Parameters and Return ValuesActivities & Teaching Strategies

Active learning works for this topic because functions with parameters and return values are abstract concepts that become concrete when students build and test them themselves. Hands-on activities let students see how changing inputs affects outputs, making the connection between local scopes and reusable code clear.

Grade 9Computer Science4 activities20 min40 min

Learning Objectives

  1. 1Analyze how function parameters increase code reusability by allowing functions to operate on different input values.
  2. 2Construct Python functions that accept multiple parameters and return a single computed value based on those parameters.
  3. 3Differentiate between functions designed to perform an action (e.g., printing output) and functions designed to return a computed value for further use.
  4. 4Trace the flow of data into a function via parameters and out of a function via a return statement in a given code snippet.
  5. 5Evaluate the effectiveness of a function based on its parameter design and the clarity of its return value.

Want a complete lesson plan with these objectives? Generate a Mission

30 min·Pairs

Pair Programming: Math Function Builder

Pairs define three functions: one for addition (two params), one for area (length, width), and one for volume (length, width, height), each returning a value. They test by calling functions in a main script and print results. Pairs swap scripts to verify outputs match expected values.

Prepare & details

Analyze how parameters enable functions to be more versatile and reusable.

Facilitation Tip: During the Pair Programming activity, circulate and ask one partner to explain the parameter’s role while the other traces the function’s execution step-by-step using print statements.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
40 min·Small Groups

Small Groups: Function Chain Relay

Groups create a chain of three functions where the return value of the first feeds as a parameter into the second, and so on, to compute a final result like compound interest. Each member codes one function. Groups run the chain and adjust for accuracy.

Prepare & details

Construct a function that takes multiple parameters and returns a computed value.

Facilitation Tip: For the Function Chain Relay, set a visible timer so groups focus on breaking tasks into small, testable functions with clear parameters and returns.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
25 min·Whole Class

Whole Class: Parameter Puzzle Share-Out

Students write a function with three parameters on paper or whiteboard, solving a shared problem like grading averages. Post solutions around the room. Class walks through, identifies parameter uses, and votes on most reusable designs.

Prepare & details

Differentiate between functions that perform an action and those that return a value.

Facilitation Tip: In the Parameter Puzzle Share-Out, select groups to present their debugging process first, highlighting how they identified misplaced or missing parameters.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
20 min·Individual

Individual: Refactor Challenge

Provide code with repeated calculations. Students identify patterns, rewrite as functions with parameters and returns, then compare original and new run times or outputs. Submit before-and-after code.

Prepare & details

Analyze how parameters enable functions to be more versatile and reusable.

Facilitation Tip: Require students to write a one-sentence comment above each function during the Refactor Challenge to explain what it returns and why that matters.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills

Teaching This Topic

Start by modeling a simple function with parameters and return, then immediately have students predict outputs before running the code. Avoid front-loading terminology; instead, let students experience the need for parameters and returns through broken examples they fix together. Research shows students grasp scope better when they physically trace variables during debugging, so always include print statements in early examples.

What to Expect

Successful learning looks like students correctly defining functions with parameters, passing arguments without confusion, and using return values in subsequent code. They should articulate why parameters isolate changes and how return values enable chaining or reuse, demonstrating both procedural and functional thinking.

These activities are a starting point. A full mission is the experience.

  • Complete facilitation script with teacher dialogue
  • Printable student materials, ready for class
  • Differentiation strategies for every learner
Generate a Mission

Watch Out for These Misconceptions

Common MisconceptionDuring the Pair Programming activity, watch for students who change a variable inside the function and assume it affects the same variable outside the function.

What to Teach Instead

Have partners add print statements before and after the function call to observe the unchanged caller variable, then discuss how parameters create isolated scopes that protect outer variables from accidental changes.

Common MisconceptionDuring the Function Chain Relay, watch for students who assume all functions must return a value to be useful.

What to Teach Instead

Direct groups to include both a procedure that prints a message and a function that returns a value in their relay. After testing, ask them to explain why one discards its result while the other enables further use.

Common MisconceptionDuring the Parameter Puzzle Share-Out, watch for students who believe return statements can only appear at the end of a function.

What to Teach Instead

Ask the presenting group to simulate early exit paths by commenting out sections and rerunning, then explain how returns work like exits in a maze, letting the function finish early when a condition is met.

Assessment Ideas

Quick Check

After the Pair Programming activity, provide a code snippet with a function like `def add_fee(price, tax_rate): return price * (1 + tax_rate)`. Ask students to identify the parameters, the arguments in a call like `add_fee(50, 0.13)`, and the expected return value before they run it.

Exit Ticket

After the Refactor Challenge, give students a scenario: 'You need a function to calculate the cost of a pizza with toppings priced per topping.' Ask them to write the function signature, include parameters for base cost and number of toppings, show a call with 12 and 3 toppings, and state the expected return value.

Discussion Prompt

During the Function Chain Relay, pose the question: 'Would you return the final grade or print it for a student report card? Why?' Have groups discuss and share their function designs, focusing on whether the output is used again or just displayed.

Extensions & Scaffolding

  • Challenge students to write a function that takes a list of numbers, filters out even numbers, and returns a new list. Ask them to chain it with another function that calculates the average of the filtered list.
  • Scaffolding: Provide prewritten function stubs with missing parameters or return statements and ask students to fill in the blanks before testing.
  • Deeper exploration: Introduce keyword arguments and default values, then have students rewrite their functions to accept optional parameters with sensible defaults.

Key Vocabulary

ParameterA variable listed inside the parentheses in a function definition. It acts as a placeholder for data that will be passed into the function when it is called.
ArgumentThe actual value that is sent to the function when it is called. This value is assigned to the corresponding parameter within the function.
Return ValueThe value that a function sends back to the part of the program that called it. This is specified using the 'return' keyword.
Function CallThe act of executing a function. When a function is called, the program jumps to the function's code, passes any arguments, and then returns to the point after the call once the function is complete.

Ready to teach Function Parameters and Return Values?

Generate a full mission with everything you need

Generate a Mission