Skip to content
Computer Science · Class 12

Active learning ideas

Function Return Values and Multiple Returns

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.

CBSE Learning OutcomesCBSE: Computational Thinking and Programming - Functions - Class 12
20–45 minPairs → Whole Class4 activities

Activity 01

Problem-Based Learning30 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.

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

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

What to look forPresent students with three function snippets. Ask them to identify which function should return a value, which should perform an action, and which implicitly returns None. For the 'return' examples, ask what data type the return value is.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Problem-Based Learning45 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.

Construct a function that returns multiple related values.

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

What to look forProvide students with a problem: 'Write a function that takes two numbers and returns their sum, difference, and product.' On their exit ticket, they should write the function definition and one sentence explaining why returning a tuple is a good approach here.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Problem-Based Learning20 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.

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

Facilitation TipFor 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.

What to look forPose the question: 'Imagine a function that prints a welcome message to the user. Should this function have a return statement? Why or why not? What happens if you try to assign the result of this function to a variable?'

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 04

Problem-Based Learning25 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.

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

Facilitation TipIn 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.

What to look forPresent students with three function snippets. Ask them to identify which function should return a value, which should perform an action, and which implicitly returns None. For the 'return' examples, ask what data type the return value is.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

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.

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.


Watch Out for These Misconceptions

  • During Pair Programming: watch for students who add return statements but still print inside the function, treating return as optional.

    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.

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

    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.

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

    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.


Methods used in this brief