Dictionaries · Explain Code

Read — build a mental model L2 Comprehension Blocks ~3 min

What does this dictionary update do?

Explain in plain English what this code does. Say what the dictionary holds, what the second line changes, and what is printed.

ages = {"Ada": 36, "Alan": 41}
ages["Ada"] = 37
print(ages["Ada"])
print(len(ages))
Why this activity was chosen
  • Bloom level: L2 Comprehension: Say in plain English what a short fragment does.
  • Block Model level: Blocks (step 2 of 4): a logical group of statements read as one unit, such as a loop, a conditional or a function.
  • Misconception targeted: shown after you answer, so it does not give the answer away.

Before students generate or accept code, they need a verbal model of behaviour. Explanation items make reading a first-class activity rather than a prelude to writing.

AI’s role here: AI may offer a hint about where to start reading, or a second explanation after the student has answered. It must not replace the student's own account of the code.