"""
If you're up for it, we can make Khansole Academy an even better learning tool. Be creative!
We recommend you start with the "three in a row" extension first, then come up with your own :-).

Three in a row

In the previous milestone you wrote code to randomly generate one addition problem at a time and tell the user
if they got it right or not. In this milestone, you should randomly generate addition 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). You should be able to use a lot of your code from the previous
milestone to help out here!

A sample run of the program is shown below (user input is in bold italics).

$ python khansole_academy.py
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.

If you hit "Mark and Submit" the computer will test if you implemented this extension correctly.

As a side note, one of the earliest programs Mehran wrote (with his friend Matthew) when he was first learning how
to program was very similar to Khansole Academy. 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. Yeah, Mehran is old.

Beyond addition?

There is no limit to how awesome you can make your learning software. Can you get it to teach?
Can you get it to offer problems other than addition? Get creative! Have fun!
"""
import random

NUM1 = random.randint(10, 99)
NUM2 = random.randint(10, 99)
PASS_MARK = 3

student_sum_total = 0

def main():
    while student_sum_total < PASS_MARK:
        addition()
    print("Congratulations. You have mastered addition.")

def addition():
    sum = NUM1 + NUM2
    print("What is", str(NUM1), "+", str(NUM2))
    answer = int(input("Your answer: "))
    if answer == sum:
        print("Correct!")
    else:
        print("Incorrect. The expected answer is", str(sum))

if __name__ == '__main__':
    main()