AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Predict first

Week 24 · Unit 10: Be a storyteller · 3 lessons
1

Number machines

Computing 2: Unit 10, pp. 134–148
GoalFollow an algorithm that works on a number, and say its output.
New words
input · the data we give to an algorithmoutput · the result an algorithm givespredict · to say what will happen before it happens
Explanation

An algorithm can work on a number that we give it. The number we give is the input. The algorithm does each step in order. What it shows at the end is the output. Before we run an algorithm, we can predict the output. We do each step with the input, just as a computer would.

Worked examples
StepInstruction
1Start
2Enter a number
3Take away 1
4Show the number
5Stop
This algorithm takes away 1 from a number. If the input is 6, the output is 5.
InputOutput
65
109
32
The same algorithm gives a different output when the input changes.
An algorithm with two steps: enter a number, double it, then add 1. With the input 4, the number becomes 8 and then 9. The output is 9.
Class activity

Number machine game (pairs): one child is the machine and thinks of a secret rule, such as “add 3” or “take away 1”. The other child says a number, which is the input. The machine says the output. After three tries, guess the rule. Swap places. Use counters if you want to check.

Practice
1
The algorithm is: enter a number, add 4, show the number. The input is 5. Predict the output.
2
The algorithm is: enter a number, take away 2, show the number. The input is 7. What is the output?
3
Tom types 8 and the machine shows 11. Which number is the input and which is the output?
4
The algorithm adds 3. Find the outputs for the inputs 2 and 6.
InputOutput
2?
6?