Problem Solving with Scratch 🧱
The same ideas as Chapter 2 — reusable blocks, boolean conditions, and passing values in — but built by snapping shapes together instead of typing syntax.
🎯 What you'll unlock this lesson
- ✅ Build a custom block ("My Block") to reuse a sequence of actions
- ✅ Use Scratch's comparison and boolean blocks in a condition
- ✅ Pass values into a custom block through its inputs
🍉 Custom blocks 3.1
In the watermelon-cutting game, every slice repeats the same three actions: play a "chop" sound, split the sprite in two, and add a point. Instead of stacking those three blocks every single time a slice happens, Scratch lets you define your own block — a custom block — that bundles them under one name.
❌ Without a custom block
Every slice event repeats the same 3 blocks — copy, paste, copy, paste...
✅ With a custom block
Define it once, then just call it by name everywhere it's needed.
Same benefit as a Python function: define once, reuse everywhere, and if the behaviour needs to change, there's only one place to edit it.
🔤 Boolean blocks 3.2
Scratch's hexagon-shaped blocks are booleans — they slot into the diamond-shaped holes of if blocks. Comparison blocks (<, =, >) and boolean blocks (and, or, not) work exactly like Python's — just shaped differently.
🎮 Interactive Condition Builder signature move
Set two numbers and an operator, then combine two comparisons with and / or — just like snapping boolean blocks together. Watch the result update live.
🎮 Passing values into a custom block 3.3
A custom block can have its own inputs ("my blocks with parameters") — round or hexagon slots added when you define the block, filled in differently each time it's called.
Definition (with an input)
Two calls, two different results
→ score increases by 1 (a normal slice)
→ score increases by 5 (a golden watermelon!)
🐍 Same idea, Python side by side
| Scratch | Python equivalent |
|---|---|
| define cut watermelon (points) | def cut_watermelon(points): |
| change score by (points) | score += points |
| cut watermelon (5) | cut_watermelon(5) |
The input on a "my block" is exactly a parameter — same concept as Chapter 2, different notation.
🍚 Activity — Aunt Cherry's fried basil chicken rice boxes
Aunt Cherry sells 15 boxes of fried basil chicken rice per batch. Enter the total ingredient cost for one batch, and this calculator works out the per-box price and a price that gives a 30% profit — exactly what the textbook activity asks you to compute by hand.
📋 More end-of-chapter activities
- 1️⃣ Survey classmates on which programs/apps they use for searching, browsing, and staying safe online.
- 2️⃣ Record classmates' height, weight, and gender, then compute the class average and the average per gender.
- 3️⃣ Plan a village New Year celebration event using the computational-thinking pillars from Chapter 1.
- 4️⃣ Design a simple student-data recording program (name, ID, grade).
- 5️⃣ Aunt Cherry's costing activity — see the calculator above.