Skip to content
Computing · Secondary 3

Active learning ideas

Introduction to Functions

Active learning works for this topic because students need to physically write, call, and trace functions to grasp the difference between definition and execution. Writing modular code by hand, discussing outputs with peers, and debugging together builds the mental model that functions are reusable tools, not one-time scripts. This hands-on approach reduces confusion about scope and return values by making abstract concepts concrete in their own editors.

MOE Syllabus OutcomesMOE: Programming - S3
25–45 minPairs → Whole Class4 activities

Activity 01

Think-Pair-Share35 min · Pairs

Pair Programming: Calculator Functions

Pairs write three functions: add, subtract, and multiply, each with two numeric parameters and a return statement. They create a main program that calls these based on user input. Pairs test with edge cases like zero or negatives, then swap code to use each other's functions.

Explain the benefits of using functions to organize and structure code.

Facilitation TipDuring Pair Programming: Calculator Functions, circulate to ensure both partners take turns defining, calling, and testing functions so neither student becomes a passive observer.

What to look forPresent students with a short Python script containing a simple function (e.g., calculating the sum of two numbers). Ask them to identify the function definition, its parameters, and the return value. Then, ask them to predict the output if the function is called with specific arguments.

UnderstandApplyAnalyzeSelf-AwarenessRelationship Skills
Generate Complete Lesson

Activity 02

Think-Pair-Share45 min · Small Groups

Small Groups: Execution Trace Relay

Divide code snippets with nested function calls among groups. Each group traces one function's flow on large paper flowcharts, predicting outputs. Groups relay to assemble the full trace, then code and run in Python to check accuracy.

Construct a simple function that takes parameters and returns a value.

Facilitation TipFor Execution Trace Relay, provide printed code snippets with blank lines for students to label each step of execution before passing to the next group.

What to look forProvide students with a scenario: 'You need to write code that converts temperatures from Celsius to Fahrenheit multiple times.' Ask them to write a Python function that takes Celsius as a parameter and returns the Fahrenheit equivalent. They should also write one line of code showing how to call their function.

UnderstandApplyAnalyzeSelf-AwarenessRelationship Skills
Generate Complete Lesson

Activity 03

Think-Pair-Share25 min · Whole Class

Whole Class: Parameter Debugging Demo

Project a buggy function with parameter mismatches. Class brainstorms fixes in a shared document. Run tests live in the interpreter, discussing each change's impact on output. Students replicate in their notebooks.

Analyze how function calls affect the flow of execution in a program.

Facilitation TipIn Parameter Debugging Demo, project a broken function and invite students to suggest fixes aloud, modeling collaborative debugging habits.

What to look forPose the question: 'Imagine you are building a calculator. Why would you choose to use functions for operations like addition, subtraction, multiplication, and division instead of writing the code for each operation directly where it's needed?' Facilitate a brief class discussion focusing on reusability and code clarity.

UnderstandApplyAnalyzeSelf-AwarenessRelationship Skills
Generate Complete Lesson

Activity 04

Think-Pair-Share30 min · Individual

Individual: Function Composition Challenge

Students build a program using three self-defined functions, like greet(name), age_group(age), and summary(name, age). Input personal data, call functions sequentially, and return a formatted message. Submit and peer review.

Explain the benefits of using functions to organize and structure code.

What to look forPresent students with a short Python script containing a simple function (e.g., calculating the sum of two numbers). Ask them to identify the function definition, its parameters, and the return value. Then, ask them to predict the output if the function is called with specific arguments.

UnderstandApplyAnalyzeSelf-AwarenessRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Experienced teachers approach this topic by starting with visible, traceable examples like area calculations or simple calculators before moving to abstract concepts. They avoid overwhelming students with complex return logic right away, instead showing how prints differ from returns through side-by-side comparisons. Research suggests mixing written tracing with live coding reduces misconceptions about scope and execution order better than lectures alone.

Successful learning looks like students confidently defining functions with parameters, calling them with varied arguments, and explaining why returns matter more than prints. They should be able to trace execution flow, spot scope issues in debugging, and compose multiple functions into a small program. Clear evidence includes correct outputs, clean code structure, and articulate explanations of reusability.


Watch Out for These Misconceptions

  • During Pair Programming: Calculator Functions, watch for students who define a function and expect results to appear immediately in the console without calling it.

    Ask pairs to annotate their code with comments like '# define' and '# call' to separate the two steps, then run the script to observe the difference in outputs.

  • During Execution Trace Relay, watch for students who assume changes to parameters inside a function affect the original variables outside it.

    In relay groups, require students to print the parameter value before and after modification inside the function to see that the change stays local.

  • During Function Composition Challenge, watch for students who rely on print statements inside functions instead of using return values for chaining.

    Have students swap partners after the first draft to review code: peers must identify which function uses print and which returns, then revise their own functions to use returns for reuse.


Methods used in this brief