design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts.

use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs

6.4b

LO: Programming Challenge 2.

like the programming challenge 1, this may be attempted individually or in pairs. This will likely take longer than a single session.

Programming Challenge 2 - Multiplication Test

Teachers would like a program that will help children learn their multiplication tables. The program needs to:

When designing your program you may have other ideas you may wish to include but these are the minimum requirements.



Let's look at these requirements:

Some examples to help:


#for loop
for i in range(1,21):

#print the question number
print("Question", i)

#generate random numbers
num1 = randint(1,12)

#cast to int
answer = int(user_input)

#check answer
if answer == (num1 * num2):

#update users score
user_score = user_score + 1

			

A complete version* of this program is available in the code example section as 6_multiplication_test.py

* There is often several ways of solving a problem, the version in the file should not be seen as the 'correct' solution.


Code Examples

Resources