Variables and values
Answers are for parents and teachers.
1
Think of a game that you play. List three variables that the game must keep track of, and give each a clear name.
For example: score, lives, time left. Accept sensible names that tell the purpose.
2
A program asks for the user’s favourite animal and stores it in a variable. Write a name for the variable and the algorithm in 5 steps.
For example: variable animal; ask the user; set animal to the answer; say ‘I like animal too’; end.
3
Trace this program: set score to 10; change score by −4; change score by 6; change score by −2. What is the final value?
10 − 4 = 6, 6 + 6 = 12, 12 − 2 = 10. The final value is 10.
4
Make a variable jar at home from a cup and slips of paper. Show a family member how the value changes while the label stays the same.
The label of the cup stays the same and the slip of paper inside changes.
5
(if you have a computer or tablet) In Scratch, make a variable called stars. Make a sprite that adds 3 to it when clicked. Test it. Is the value what you traced?
After 4 clicks the value is 12. The child should set stars to 0 when the flag is clicked.