Skip to content

Function Return Values and Multiple ReturnsActivities & Teaching Strategies

Active learning helps students grasp function return values because seeing None propagate or unpacking tuples builds concrete intuition that lectures alone rarely achieve. When students write functions that return data instead of printing, they internalise how return statements control programme flow and data flow in ways that passive reading cannot.

Class 12Computer Science4 activities20 min45 min

Learning Objectives

  1. 1Analyze scenarios to determine if a function should return a value or perform an action.
  2. 2Construct Python functions that return multiple related values using tuples.
  3. 3Evaluate the consequences of a function implicitly returning None in a program's data flow.
  4. 4Compare the efficiency of returning multiple values via tuples versus using global variables.
  5. 5Design a program module where functions effectively pass data using return values.

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

30 min·Pairs

Pair Programming: Build Return Functions

Pairs write three functions: one returning a single sum, one a tuple of min and max from a list, and one without return to observe None. Test by calling in a main script and printing results. Discuss differences in output.

Prepare & details

Evaluate scenarios where a function should return a value versus performing an action.

Facilitation Tip: In Pair Programming, ask partners to switch roles after every three function definitions so both students practise writing return statements under live peer feedback.

Setup: Standard classroom with movable furniture arranged for groups of 5 to 6; if furniture is fixed, groups work within rows using a designated recorder. A blackboard or whiteboard for capturing the whole-class 'need-to-know' list is essential.

Materials: Printed problem scenario cards (one per group), Structured analysis templates: 'What we know / What we need to find out / Our hypothesis', Role cards (recorder, researcher, presenter, timekeeper), Access to NCERT textbooks and any supplementary reference materials, Individual reflection sheets or exit slips with a board-exam-style application question

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
45 min·Small Groups

Small Group Debug: Multiple Return Challenges

Groups receive buggy code snippets with functions meant to return coordinates as tuples. Identify errors, fix returns, and integrate into a simple game loop. Share one fix with class.

Prepare & details

Construct a function that returns multiple related values.

Facilitation Tip: During Small Group Debug, provide printed snippets with deliberate missing returns and multiple prints to prompt students to refactor into tuple returns.

Setup: Standard classroom with movable furniture arranged for groups of 5 to 6; if furniture is fixed, groups work within rows using a designated recorder. A blackboard or whiteboard for capturing the whole-class 'need-to-know' list is essential.

Materials: Printed problem scenario cards (one per group), Structured analysis templates: 'What we know / What we need to find out / Our hypothesis', Role cards (recorder, researcher, presenter, timekeeper), Access to NCERT textbooks and any supplementary reference materials, Individual reflection sheets or exit slips with a board-exam-style application question

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
20 min·Whole Class

Whole Class Trace: Function Call Simulation

Project code on board; class calls out step-by-step execution, noting return points with tokens. Volunteers rewrite for multiple returns. Vote on best versions.

Prepare & details

Analyze the implications of a function not explicitly returning a value.

Facilitation Tip: For Whole Class Trace, prepare a large call stack diagram on the board so every student can follow how a single return value travels back through each caller.

Setup: Standard classroom with movable furniture arranged for groups of 5 to 6; if furniture is fixed, groups work within rows using a designated recorder. A blackboard or whiteboard for capturing the whole-class 'need-to-know' list is essential.

Materials: Printed problem scenario cards (one per group), Structured analysis templates: 'What we know / What we need to find out / Our hypothesis', Role cards (recorder, researcher, presenter, timekeeper), Access to NCERT textbooks and any supplementary reference materials, Individual reflection sheets or exit slips with a board-exam-style application question

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
25 min·Individual

Individual Refactor: Action to Return

Students get print-only functions, refactor to return values instead, then chain in a programme. Submit before-after code with notes on improvements.

Prepare & details

Evaluate scenarios where a function should return a value versus performing an action.

Facilitation Tip: In Individual Refactor, give students a function that prints dimensions and returns None; they must change it to return the tuple (length, breadth) for later use in area calculations.

Setup: Standard classroom with movable furniture arranged for groups of 5 to 6; if furniture is fixed, groups work within rows using a designated recorder. A blackboard or whiteboard for capturing the whole-class 'need-to-know' list is essential.

Materials: Printed problem scenario cards (one per group), Structured analysis templates: 'What we know / What we need to find out / Our hypothesis', Role cards (recorder, researcher, presenter, timekeeper), Access to NCERT textbooks and any supplementary reference materials, Individual reflection sheets or exit slips with a board-exam-style application question

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills

Teaching This Topic

Start with a live demo that shows two versions of the same programme: one that prints results and one that returns them. Students notice immediately that returned values can be reused, while printed values cannot. Emphasise that functions should either return data or perform side effects, not both, to keep programmes predictable. Research shows that contrasting correct and incorrect patterns early reduces later misconceptions about implicit None.

What to Expect

By the end of these activities, students will confidently write functions with single and multiple returns, distinguish between returning values and printing, and trace where return values travel after a function call. They will also recognise when a return is missing and how that affects subsequent operations.

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 Pair Programming: watch for students who add return statements but still print inside the function, treating return as optional.

What to Teach Instead

Prompt pairs to delete all print lines inside their function and instead return the value; ask them to print only after calling the function, so they see return’s role in data flow.

Common MisconceptionDuring Small Group Debug: watch for groups that add multiple prints to simulate multiple returns instead of returning a tuple.

What to Teach Instead

Give each group a printed reference card showing tuple syntax and unpacking; require them to replace three prints with one tuple return and show how the caller unpacks it.

Common MisconceptionDuring Whole Class Trace: watch for students who assume strings and lists cannot be returned, expecting only numbers.

What to Teach Instead

Use the trace on the board to show a function returning ['hello', 'world'] and immediately using the list in the next statement; ask students to add their own typed return in the trace.

Assessment Ideas

Quick Check

After Pair Programming, display three snippets on the projector. Ask students to identify which snippet must return a value, which performs an action, and which returns None implicitly. Collect responses via show of hands and discuss.

Exit Ticket

After Individual Refactor, ask students to write a function that takes two numbers and returns their sum, difference, and product as a tuple. On the same ticket, they should write one sentence explaining why returning a tuple helps reuse the results in later calculations.

Discussion Prompt

During Whole Class Trace, pose the question: 'Should a function that prints a welcome message also return anything? What happens if we assign result = welcome()? Ask students to predict and then trace the programme together to see what value ends up in result.

Extensions & Scaffolding

  • Challenge: Ask students to write a function that takes a list of marks, returns a dictionary with average, highest, and lowest marks, and then use these values to compute a grade.
  • Scaffolding: Provide a partially filled function skeleton with comments like '# add return statement here' and '# pack results into a tuple'.
  • Deeper exploration: Students research how Python’s yield statement differs from return and present a 2-minute comparison to the class.

Key Vocabulary

return statementA command in Python that exits a function and sends a specified value back to the part of the program that called the function.
tupleAn ordered, immutable collection of items in Python, often used to group multiple related values returned from a function.
NoneA special constant in Python representing the absence of a value, which is implicitly returned by functions that do not have an explicit return statement.
data flowThe path along which data travels through a program, influenced by how functions pass values back to their callers.

Ready to teach Function Return Values and Multiple Returns?

Generate a full mission with everything you need

Generate a Mission