3
Steps to finish a task
Computing 2: Unit 4, pp. 54–65
GoalBreak a task into steps, take out a step that is not needed and put the steps in order.
New words
task · a job to doextra step · a step that is not neededorder · which step comes first, next and last
Explanation
To write an algorithm for a task, we break the task into steps. First think about what must happen. Write down every step. Cross out any extra step that is not needed. Put the steps in the right order. Last, read the algorithm from the first step to the last, and check that it works. A task such as making a fruit salad needs only a few steps.
Worked examples
| Step | Instruction |
|---|---|
| 1 | Get the fruit |
| 2 | Wash the fruit |
| 3 | Cut the fruit |
| 4 | Put the pieces in a bowl |
| 5 | Mix |
| Step | Instruction |
|---|---|
| 1 | Get the fruit |
| 2 | Paint a picture |
| 3 | Wash the fruit |
| 4 | Cut the fruit |
Some days need more steps. On a sports day, getting ready for school needs two extra steps: put on your trainers and pack a water bottle.
Class activity
Task cards: choose one task, such as getting ready for school. Write each step on a small card. Add one extra card that does not belong, for example “Ride a rocket”. Mix the cards. A friend takes out the extra card and puts the rest in order. Then follow the algorithm for real. Did it work? If not, find the bug and fix it.
Practice
1
Put the steps for feeding a dog in the right order: A Put the bowl down for the dog. B Fill the bowl with dog food. C Get the dog’s bowl. D Call the dog.
C, B, D, A. Get the bowl, fill it, call the dog, then put the bowl down.
2
Which step is not needed when planting a seed?
| Step | Instruction |
|---|---|
| 1 | Dig a hole |
| 2 | Put the seed in the hole |
| 3 | Ride a bike |
| 4 | Cover the seed with soil |
| 5 | Water it |
Ride a bike.
3
Write four steps for making a glass of squash.
For example: 1 Get a glass. 2 Pour a little squash in the glass. 3 Add water. 4 Stir.
4
What steps would you add to getting ready for school on a swimming day?
For example: pack a swimsuit, a towel and a swimming cap.