Loops · Extend the Code

Shape — improve or specify L5 Synthesis Macro Structure ~5 min

From a total to an average

This program totals a list of scores. Extend it so it also prints the average score. The average should be calculated once, after all the scores have been added. You may write code or describe your changes in words.

scores = [60, 75, 90]
total = 0
for s in scores:
    total = total + s
print(total)
Why this activity was chosen
  • Bloom level: L5 Synthesis: Add functionality to working code, combining ideas.
  • Block Model level: Macro Structure (step 4 of 4): the purpose of the whole program: the problem it solves and the goal it serves.
  • Misconception targeted: shown after you answer, so it does not give the answer away.

Synthesis: combining concepts already met (variables, loops, conditions, lists, functions) to build something new on a working base, and reasoning about where the new code belongs.

AI’s role here: AI may ask what information the new feature needs. It must not write the extension.