Now that you’ve seen how programming can help us in a number of different areas, it’s time for you to implement Khan-sole Academy—a program that helps other people learn! In this problem, you’ll write a program in the file that randomly generates simple addition problems for the user, reads in the answer from the user, and then checks to see if they got it right or wrong, until the user appears to have mastered the material. Note that “console” is another name for “terminal” :-).

More specifically, your program should be able to generate simple addition problems that involve adding two 2-digit integers (i.e., the numbers 10 through 99). The user should be asked for an answer to each problem. Your program should determine if the answer was correct or not, and give the user an appropriate message to let them know. Your program should keep giving the user problems until the user has gotten 3 problems correct in a row. (Note: the number of problems the user needs to get correctly in a row to complete the program is just one example of a good place to specify a constant in your program). A sample run of the program is shown below (user input is in bold).

What is 51 + 79?
Your answer: 120
Incorrect. The expected answer is 130
What is 33 + 19?
Your answer: 42
Incorrect. The expected answer is 52
What is 55 + 11?
Your answer: 66
Correct! You've gotten 1 correct in a row.
What is 84 + 25?
Your answer: 109
Correct! You've gotten 2 correct in a row.
What is 26 + 58?
Your answer: 74
Incorrect. The expected answer is 84
What is 98 + 85?
Your answer: 183
Correct! You've gotten 1 correct in a row.
What is 79 + 66?
Your answer: 145
Correct! You've gotten 2 correct in a row.
What is 97 + 20?
Your answer: 117
Correct! You've gotten 3 correct in a row.
Congratulations! You mastered addition.

As a side note, one of the earliest programs one of the instructors, Mehran, of Stanford's CS106A class, wrote (with his friend Matthew) when he was first learning how to program was very similar to Khan-Sole Academy and it was called “M&M’s Math Puzzles”. It was written in a language named BASIC, on a computer that had 4K of memory (that’s 4 Kilobytes) and used cassette tapes (the same kind used for music in the 1970’s) to store information.