Get a glass of water
- 1
Take a glass.
- 2
Put it under the tap.
- 3
?
- 4
Turn off the tap.
Which step is missing?
BEFORE PYTHON
A plan is a few steps in an order that works.
YOU ALREADY KNOW THIS
When you get ready, play, or make something, your brain quietly chooses what happens first, next, and last.
Coding uses that same skill. You do not have to know everything at once.YOUR TURN
A step is missing. It can be first, in the middle or last. Pick it, and PyBot will check it.
Take a glass.
Put it under the tap.
?
Turn off the tap.
Which step is missing?
?
Add your notebooks.
Add your pencil case.
Close the bag.
Which step is missing?
Wet your hands.
?
Scrub and rinse.
Turn off the tap.
Which step is missing?
Put toothpaste on the brush.
Brush your teeth.
Rinse the toothbrush.
?
Which step is missing?
Put on your shirt.
Put on your pants.
?
Put on your shoes.
Which step is missing?
Get a bowl.
?
Add milk.
Get a spoon.
Which step is missing?
?
Choose your crayons.
Draw your picture.
Put the crayons away.
Which step is missing?
Put on your pajamas.
Brush your teeth.
Get into bed.
?
Which step is missing?
Choose a book.
Sit somewhere comfortable.
?
Start reading.
Which step is missing?
Open the camera.
?
Hold the device still.
Tap the photo button.
Which step is missing?
NEW CHALLENGE
The steps got mixed up. Drag them up or down, then check your plan.
Drag a step, or select it and use the up and down arrow keys.
Drag the steps into the right order.
Cover it with soil.
⋮⋮Dig a small hole.
⋮⋮Water it.
⋮⋮Drop the seed in.
⋮⋮Drag the steps into the right order.
Put the other slice on top.
⋮⋮Spread butter on one slice.
⋮⋮Take two slices of bread.
⋮⋮Add the cheese.
⋮⋮Drag the steps into the right order.
Wrap the box in paper.
⋮⋮Stick a bow on top.
⋮⋮Put the gift in a box.
⋮⋮Hold the paper with tape.
⋮⋮Close the box.
⋮⋮Want a fresh start? Clear only this page.
A NEW WORD
An algorithm is a list of clear steps, in order, that solves a problem. Every plan you just finished is an algorithm!
Each step says exactly what to do. No guessing.
First, next, last. If you swap steps, the plan can break.
It stops when the job is done.
ALGORITHMS IN CODE
When you write code, you write the steps. The computer reads them one at a time, from top to bottom, and does exactly what each line says.
The computer never guesses. If a step is missing or in the wrong place, it will not fix it for you.Goal: a full glass, and not one drop of water wasted.
Swap lines 2 and 3: the tap opens before the glass is under it, and the water runs down the drain. Wasted!
Swap lines 4 and 5: the tap closes first, the glass never fills, and PyBot waits forever!
Clear steps in order make an algorithm. Computers follow algorithms one step at a time.