Sep-30-2019, 11:20 PM
So, for my homework assignment, I am required to write a function called "check_answer" which will determine if a given addition or subtraction problem was solved correctly.
I would like to know how I can properly call this function, and how I can start checking the answer. Am I on the right track by using "if statements?"
(Please excuse my newbie language, I'm really new to python as you can tell.)
I would like to know how I can properly call this function, and how I can start checking the answer. Am I on the right track by using "if statements?"
(Please excuse my newbie language, I'm really new to python as you can tell.)
def Main(): int1 = int(input("Please enter a integer: ")) int2 = int(input("Please enter a second integer:")) return int1 return int2 def check_answer(): print("Started") answer1 = check_answer(1, 2, 3, "+") output = (answer1) print(answer1) if answer1 == 6: print ("True") if answer1 != 6: print("False") answer2 = check_answer(1, 2, -1, "-") output = (answer2) print (answer2) if answer2 == -1: print("True") if answer2 != -1: print("False") answer3 = check_answer(9, 5, 3, "+") output = (answer3) print (answer3) if answer3 == 17: print("True") if answer3 != 17: print("False") answer4 = check_answer(8, 2, 4, "-") output = (answer4) print (answer4) if answer4 == 4: print("True") if answer4 != 4: print("False") print(check_answer) return output if __name__ == "_check_answer_": check_answer()