What it shows
A loop asks random multiplication questions, reads what you type with the answer block and compares it with the right product. It shows how a program takes input and makes decisions.
The science
The ask and wait block shows a question and stores the typed reply in the answer reporter. An if else block compares the answer with a calculation: if they are equal the program does one thing, otherwise it does another. Repeating the same block ten times with random numbers gives ten different questions from one short program.
Materials
Cost: free. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- A computer, laptop or phone with a browser (free)
- Scratch 3 in the browser at scratch.mit.edu (free, no sign-in needed to code)
- A friendly sprite such as a Teacher or a Cat
- A notebook and a pencil
Safety
This project uses safe, everyday materials. Still, read the rules below with a parent before you start.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
All the safety rulesStep by step
8 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Make three variables for all sprites: score, a and b.
Build: when green flag clicked, set score to 0, then a repeat 5 block.
Inside the repeat, add set a to (pick random 2 to 10) and set b to (pick random 1 to 10).
Add ask (join (a) (join [ x ] (b))) and wait; use the green join block twice so the question reads like 7 x 6.
Add an if else block with the condition (answer) = ((a) * (b)) from the green Operators.
In the if part use change score by 1 and say Correct! for 1 seconds; in the else part use say (join [No, it is ] ((a) * (b))) for 2 seconds.
After the repeat finish with say (join [Your score is ] (score)).
Click the green flag, answer the questions, and then change the pick random ranges to practise only the 7 times table.
What you should see
The sprite asks five random multiplication questions, says Correct or gives the right answer, and ends by showing the score out of five.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
1What does the answer block hold?
The last thing the user typed in reply to the ask block.
2Why do we use if else?
To do one action for a right answer and a different action for a wrong answer.
3What does repeat 5 do?
It runs the blocks inside it five times, so the quiz has five questions.
4How would you make it a division quiz?
Pick the answer first, multiply to make the question number, and ask the division.
Take it further
Add a list called wrong sums and add each missed question to it, then show them at the end for revision.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
Free ebooks for this project
Computer & office
Computer Fundamentals Study Book
The complete study notes, practice questions and glossary for Computer Fundamentals
