December 2000
Intermediate to advanced
816 pages
16h 57m
English
The main driver of the application is main(), called from the top-level if the script is invoked directly. If imported, the importing function either manages the execution by calling doprob(), or calls main() for program control. main() simply calls doprob() to engage the user in the main functionality of the script and prompts the user to quit or to try another problem.
Since the values and operators are chosen randomly, each execution of matheasy.py should be different. Here is what we got today (oh, and your answers may vary as well!):
% matheasy.py 7 - 2 = 5 correct Try another? ([y]/n) 7 * 6 = 42 correct Try another? ([y]/n) 7 * 3 = 20 incorrect… try again 7 * 3 = 22 incorrect… try again 7 * 3 = 23 sorry… the answer is 7 * ...
Read now
Unlock full access