Skip to main content
โ† Back to Traditional Coding samples
โŒจ๏ธTraditional Codingยท15 minยทSample Lesson

Follow the Steps: Coding Is Just Giving Directions

Imagine you want a robot to make a peanut butter sandwich. You can't just say "make a sandwich" โ€” the robot doesn't know what that means! You have to spell out every single step: open the bread bag, take out two slices, open the peanut butter jar, dip in the knife, spread it on one slice, close the jar, put the slices together. Miss even one step, like "open the jar," and the robot might try to spread peanut butter through a closed lid! That list of exact steps is called an algorithm, and writing algorithms for a computer to follow is what coding really is.

What You'll Learn

- What an algorithm is and why every step counts - Why the ORDER of steps changes the result - What a "bug" is and how to fix one - How to write your own step-by-step algorithm

What Is an Algorithm?

An algorithm is just a list of steps written in order to get something done. You already follow algorithms every day! Brushing your teeth is an algorithm: wet the brush, add toothpaste, brush top teeth, brush bottom teeth, rinse, spit. A computer needs the exact same kind of list โ€” except it can't guess what you meant. It only does exactly what you tell it, in exactly that order.

Order Matters

Try this: "Put on your shoes. Put on your socks." That's the wrong order โ€” now your socks are stuck under your shoes! If you told a computer to do things in the wrong order, it would make the same silly mistake. Coders have to think very carefully about which step comes first, second, and third, because a computer will never fix the order for you.

Try This at Home

Write down the steps for tying your shoe, one step per line. Then ask a grown-up to follow your steps EXACTLY as written โ€” even if it looks silly. Did they end up with tied shoes?

Bugs: When Steps Go Wrong

When a set of steps doesn't work the way you planned, coders call that a bug. It doesn't mean an actual insect crawled into the computer โ€” it means one of your steps was missing, wrong, or in the wrong order. Finding and fixing a bug is called debugging, and every coder in the world does it, every single day.

Match each coding word to what it means.

Terms

Algorithm
Bug
Debugging
Sequence

Definitions

The order that steps happen in
A mistake that makes the steps go wrong
A list of steps in order
Finding and fixing the mistake

Drag terms onto their definitions, or click a term then click a definition to match.

โ“

You told a robot: "Put on your shoes. Put on your socks." What will happen?

โ“

What do coders call it when they find and fix a mistake in their steps?

๐ŸŽฏ

Write Your Own Sandwich Algorithm

On paper, write the exact steps for making your favorite snack, one step per line (at least 6 steps). Then ask a family member to be your "robot" and follow ONLY what you wrote, doing nothing you didn't say. If they get stuck or do something silly, add or fix a step. Turn in your final, working list of steps.

Want to keep learning?

Sign up for free to access the full curriculum โ€” all subjects, all ages.

Start Learning Free