0

Automate the Boring Stuff with Python (Chapter 8): Write Your Own Multiplication Quiz

Hi, this is the challenge: To see how much PyInputPlus (module) is doing for you, try re-creating the multiplication quiz project on your own without importing it. This program will prompt the user with 10 multiplication questions, ranging from 0 × 0 to 9 × 9. You’ll need to implement the following features: If the user enters the correct answer, the program displays “Correct!” for 1 second and moves on to the next question. The user gets three tries to enter the correct answer before the program moves on to the next question. Eight seconds after first displaying the question, the question is marked as incorrect even if the user enters the correct answer after the 8-second limit. This is my answer: https://code.sololearn.com/ciTtqGjUi86I/?ref=app Perhaps any of you can complete this exercise without making so many copies of the same code?

13th Nov 2020, 7:28 PM
Vasyl Makoviychuk
2 Antworten
0
All your functions do the same thing. That's bad, contradicts the main coding principle "don't repeat yourself" (DRY) You should only have a single function def question() And call it multiple times in a loop like this for n in range(10): question()
14th Nov 2020, 7:11 AM
Tibor Santa
Tibor Santa - avatar