To gain experience writing programs with random numbers and nested control structures.
For this assignment, you will write a program to quiz the user on multiplication problems. The program will ask the user how many problems they want to solve, and then generate that many problems randomly. At the end of the problem, it will tell the user how many problems they got right, along with the percentage.
random.randint
, passing in the bounds the user set.Here is an example run so that you can see how this program will work.
How many problems? 5 What's the smallest number? 1 What's the biggest number? 10 What's 2 times 7? : 14 Correct What's 3 times 6? : 21 No, the answer is 18. What's 3 times 10? : 30 Correct What's 5 times 9? : 45 Correct What's 9 times 10? : 90 Correct You got 4 out of 5. That is 80.0%.
For extra credit, you can make the quiz ask more than just multiplication questions, such as addition and/or division. You can either ask the user what sorts of questions they want to solve, or you can have it randomly pick what sorts of questions.
When writing your program, also be sure to:
When you are finished, please submit the .py file for the assignment on Canvas.
Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.