Activity 01
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.