๐ ๏ธ Section project: the maths quiz
Section 7: Variables and randomnessLesson 7.3 ยท โฑ 15 min
Robo becomes a teacher: he asks you addition questions with random numbers and counts your points.
๐ฏ Project goal
Robo asks 5 different addition questions. Every right answer adds a point to score, and at the end he says your score.
Steps
- Make 3 variables: score, a and b.
- Set score to zero at the start.
- Inside repeat (5): set a and b to random numbers from 1 to 10, then ask for their sum.
- If answer equals a + b, change score by 1 and say Correct!
- After the loop, say the score.

๐ก Tip
The join block sticks words and numbers together, like 3 + 4 in one question.
๐ Another example: one question, two answers
if โฆ else chooses: if the answer is 56 he praises you, else he tells you the right answer.



โ๏ธ Practise
Build the whole maths quiz here, and test a friend.
โ๏ธ Practise here in the lessonโ Close the labor open the lab in a new page โ
๐ฏ Challenge yourself
Easy
Robo asks your name, then says โHello,โ and your name.
๐ Show the solution๐ Hide the solution


Medium
Robo asks your age: if it is more than 9 he suggests the hard level, else the easy level.
๐ Show the solution๐ Hide the solution


Hard
A times-table quiz: 3 random questions (a ร b), a wrong answer shows the right one, and the score at the end.
๐ Show the solution๐ Hide the solution



