Topics / Functions

Functions

Parameters, return values, and the difference between printing and returning.

Generated helpers often print when the caller needed a value, or ignore an edge case in the contract. Students need to read the function as a specification, not as a block of syntax.

Identify Terminology L1 Knowledge Atoms ~1 min

Parameter or argument?

In this function definition, what is the name `name` called?

Start activity
Define a Concept L1 Knowledge Atoms ~2 min

Define a function

In your own words, what is a function, and why do programmers use them? Say what it is, not how to write …

Start activity
Match Terms to Definitions L1 Knowledge Atoms ~2 min

Match the function vocabulary

Match each term to the definition that fits it. The code is there so you can see what each term refers to; …

Start activity
Program Tracing L2 Comprehension Relations ~3 min

What does double(4) give back?

What is printed when this program runs?

Start activity
Explain Code L2 Comprehension Blocks ~3 min

What does this function take in and give back?

Explain in plain English what the function does and how the program uses it. Say what goes in, what comes out, and …

Start activity
Prompt Construction L3 Application Macro Structure ~5 min

Specify a vowel counter without writing it

Do not write the Python. Write a short specification (the kind of prompt you would give a colleague or a model) that …

Start activity
Debugging L4 Analysis Relations ~4 min

The average that came back empty

The programmer expected this program to print only 'Average is 6.0'. Instead it prints 6.0 on one line and 'Average is None' …

Start activity
Code Improvement L5 Synthesis Macro Structure ~5 min

Stop repeating the tax calculation

An AI generated this code to show prices with 20% tax. It works but repeats itself. Improve it by removing the duplication, …

Start activity
AI Suggestion Evaluation L6 Evaluation Relations ~4 min

Is this even-number test trustworthy?

A student asked an AI to complete is_even so that it returns True when n is even. The AI suggested the highlighted …

Start activity