Python 3


"The first Python course that simply amazed me. Very well explained and easy to understand." (Alexandru Cosmin)

"The best Python course in Romania." (Iulian Geană)

PAGE 1 / 1
Quiz - Multiplication Table
Home >>> Online Lessons, Python 3

We intend to create a test consisting of 10 multiplication operations with natural numbers between 1 and 10. Each operation will display a validation message for the result, and at the end, the final score!

Solution. This time, we will need two random numbers generated at each step (stored in variables n and m), and since we know the total number of iterations, we will use the for loop.

Analyze the program (without styling):
Editor -
Console/Output done

The variable ok keeps track of the number of correct answers provided by the user.

Note the input() function, which can receive a string as a parameter. We used explicit conversion to the str type for the two generated numbers so that the + operator can be used.

My styled program is []. Download and run it on your computer!


1. It would be correct for the score to start from 1, and for each correct answer 0.9 points to be added. Pay attention to rounding, you already know the function! Make the changes!

2. Modify the program so that addition operations with numbers between 1 and 100 are performed.

3. Can you create a program that offers addition and subtraction operations, similar to the previous one, at random?

Hint. I think you need a new random number. If it's zero, offer addition, and if it's one, offer subtraction...

Mini-project. Create a program that gives the user the option to choose the operation – addition, subtraction, or multiplication (more precisely, a small menu). Depending on the entered value, display a test consisting of ten questions.

Hint. It's not that complicated... :) it's just a few more instructions.

This section is now over.
 home   list  CONTENTS   perm_identity   arrow_upward