Variables · Extend the Code

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

Add a discount without a magic number

This program prices an order. Extend it so it also applies a 10% discount and prints the discounted total. Use a named variable for the discount rate rather than typing the number inside the calculation. You may write code or describe your changes in words.

price = 20
quantity = 3
total = price * quantity
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.