Week 4
Little Professor
The same random integer, split into the functions the spec already names.
A level of 1, 2, or 3, then answers to ten additions.
A score out of ten. Each problem allows a few tries.
The question, more slowly
The question is a little quiz of ten addition problems. The level is 1, 2, or 3, and you ask again until you get one of those. Each number in a problem has that many digits. One digit includes 0 through 9. Two digits are 10 through 99. Three digits are 100 through 999.
Each problem allows three tries. A wrong answer or a non-number costs a try and shows the error the spec names. After the third miss, show the right equation and move on. The last line is how many of the ten were answered correctly. Finish one problem's pair of numbers before you invent the next pair. The checker cares about that order.
The spec already names the functions. One gets the level. One makes a single integer with the right number of digits, and raises if the level is not 1, 2, or 3. The score lives in main, not inside the integer function.
Before you code
Write the smallest and largest non-negative integer with 1, 2, and 3 digits. One digit includes 0.