Example #1
0
def the_correct_result_should_be_result(result):
    assert ql.getResult(n1, n2, 0) == result
def the_correct_result_should_be_result(result):
    assert ql.getResult(n1, n2, 0) == result
Example #3
0
        n1 = sys.div.arr[0][sys.div.col]
        n2 = sys.div.arr[sys.div.row][sys.div.col]
        sys.div.arr[sys.div.row][sys.div.col] = 0

    #Displaying operation question to user
    ql.displayQ(n1, n2, sys.opNum)

    #Asking user's answer. Keep asking until number is entered.
    while True:
        try:
            userAns = int(raw_input())
        except ValueError:
            print("Not a valid entry. Only numbers accepted.")
            continue
        else:
            break

    #Getting correct answer
    correctAns = ql.getResult(n1, n2, sys.opNum)

    #If user's input is correct:
    if (userAns == correctAns):
        #Score increases by 1
        sys.incPoints()

    #qRemaining decreases by 1
    sys.decQRem()

    #Display score and qRemaining
    ql.displayScore(sys.qTotalRem, sys.points)