Do you want a chance to be the teacher? This project tests users on their times tables and displays times tables so a user can practice. It keeps score and records how long it took to take the test.
Here’s where you put your class skills to the test and give your brain a workout.
Planning Your Math Trainer
Your math trainer should ask for answers about the times tables (from 1 through 12) and make sure the answer is right.
But does your best friend need help memorizing the tables? The math trainer could print out a times table. Maybe your other BFF knows the smaller numbers already, so the trainer should set a bottom limit (just avoid the 1s, for instance). If you like, you can add a higher upper limit than 12.
Add a score and time how long it takes to take the test. Game on!
Set up your file and put some code in that asks a question and works out whether the answer is correct.
Do the following to get the project up and running:
- Create a new file called math_trainer.py.
- Create a module docstring for the file.
Use a hash comment to mark these sections: Imports, Constants, Function, and Testing.
You know from the silly sentences project that if you put a tuple after a formatting operator %, Python unpacks the tuple into formatting specifiers in the formatting string. That means that "What is %sx%s?"%(4,6) becomes "What is 4x6?". You’re ...