Arithmetic Quiz

arithmetic-quiz-calculatorFor this challenge we will create a maths quiz consisting of ten arithmetic questions. Each question will be randomly generated using two random operands between 1 and 12 and one random operator, either + (addition), – (subtraction) or x (multiplication). We will not include the division operator as this could result in a decimal value.

We will include a scoring system to our quiz. The player will be asked one question at a time and score 10 points per correct answer and lose 5 points per incorrect answer.

Complete the code

We have started with just a few lines to generate a random question.
Your task is to add some code to:

  1. Calculate the correct answer,
  2. Compare the user answer with the correct answer to see if the user is correct or not,
  3. Add 10 points for a correct answer or subtract 5 points for an incorrect answer,
  4. Use a loop to repeat this code 10 times,
  5. Display the final score, out of 100.

Extension Task

Why not add a leaderboard to your quiz. This would be used to store the player’s scores and display the top ten scores on screen, in descending order.

Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges

Our Latest Book