May-01-2018, 04:31 PM
def quiz(question, solution): answer = input("State the solution to the quiz: ") if answer == solution: return True else: print("Wrong Answer!\nTry again...\n") answer = input("State the solution to the quiz: ") while quiz(question, solution) == False: print("Wrong Answer!\nTry again...\n")Line 8 is calling quiz, the function that it's part of, (this is called recursion),
to avoid this, your while statement needs to encompass everything from answer to the end like:
def quiz(question, solution): answer = None while answer is None: answer = input("State the solution to the quiz: ") if answer != solution: print("Wrong Answer!\nTry again...\n") answer = None return True