Beep! Tap the happy computer!
How computers think

Is a recipe a program?

# Algorithms are recipes An **algorithm** is a clear list of steps to solve a problem. ## Maggi algorithm 1. Boil water 2. Add noodles 3. Add tastemaker 4. Cook 2 minutes 5. Serve If you skip step 1, dinner fails. Computers are the same — they follow the steps they are given, even silly ones. ## Good algorithms - **Clear** — no confusing words - **Finite** — they finish - **Correct** — they solve the real problem - **Efficient** — not 100 extra useless steps ## Daily algorithms Tying shoes, logging into email, finding the smallest number in a list. > Coding is writing algorithms in a language a computer understands. ## Three tests of a good algorithm 1. **Clear** — a new student could follow it 2. **Ordered** — step 3 depends on step 2 being done 3. **Finite** — it stops ### From English to code Later, each English step becomes one or two lines of Python. If the English is muddy, the code will be muddy. That is why we practise algorithms in words first. ### Pseudocode Teachers sometimes ask for **pseudocode** — English written in code-shaped lines: ``` START input marks if marks >= 40 then output "Pass" else output "Try again" end if STOP ``` You will meet this shape again in If/else.

By the end of this lesson

Write a 5–8 step algorithm for an everyday task and spot a missing or unordered step.

Remember

  • An algorithm is a clear list of steps to solve a problem.
  • Steps must be in order, have an end, and be understandable by the follower.
  • Recipes, tying shoes, and “how to add two 2-digit numbers” are algorithms.
  • A missing step or a wrong order is a bug in the algorithm.
  • Every function you later write in Python is an algorithm in a language a machine can run.

Worked examples

Cover the answer. Try the steps on paper, then open them.

Example 1 — Tea algorithm

Write steps that a robot could follow.

  1. Fill kettle with water
  2. Switch kettle on
  3. Put tea leaf / bag in cup
  4. When water boils, pour into cup
  5. Wait 2 minutes
  6. Add milk / sugar if wanted
  7. Stop

Answer: ordered, finite, clear

Check: “Make tea nicely” is not an algorithm — too vague.

Example 2 — Broken Maggi

Steps: add masala; eat; boil water; open packet. What is wrong?

  1. Order is scrambled
  2. You cannot eat before cooking
  3. Fix: open → water → boil → noodles → masala → wait → eat

Answer: wrong sequence

Check: Sequence bugs start here, before code.

Example 3 — School algorithm

Borrow a library book.

  1. Enter library
  2. Find the book on the shelf / catalogue
  3. Take it to the desk
  4. Show ID / scan
  5. Leave with the book
  6. Return by the due date

Answer: clear start and end

Check: Has an end — algorithms must stop.

Common mistakes

Slip Writing “do it properly” as a step.

Fix The follower cannot act on “properly”.

Use verbs you can see: pour, click, add 1.

Slip An infinite algorithm with no stop.

Fix “Keep stirring forever” never finishes.

Say when to stop.

Slip Thinking only computers have algorithms.

Fix Humans follow algorithms all day.

Computers just follow them without getting bored.

Try on paper first

Write the answer, then tap Reveal. These are not the quiz — they are warm-ups.

1. In one sentence, what is an algorithm?

Answer: A clear list of steps to solve a problem

2. Name one everyday algorithm.

Answer: Recipe / tying laces / morning routine (any)

3. If steps are in the wrong order, we call that a…

Answer: Bug (sequence error)

4. Must an algorithm end?

Answer: Yes

Touch practice

8 tap / type

Tap or type. Use the hint if you need it. Retry any miss — the why is the lesson.

Optional picture lab

After practice

Real world

Making tea, tying shoes.

Connect

Every function is an algorithm.

⭐ Star quiz

9 questions

Do the worked examples and touch practice first. Then take the quiz without peeking.