def math_answer_valid(answer):
    """The purpose of this function is to prevent errors within the
    honeybee_math() function by ensuring answers to the math questions
    are integers. If the user does not provide a valid input, this function
    will prompt the user until they enter a valid integer input. Once the
    user enters a valid integer value, the value is returned."""
    # A try statement tests to ensure the user input is an integer (all math
    # question answers are integers)
    try:
        # If the user input is an integer, it is returned in integer form
        valid_answer = int(answer)
        return int(valid_answer)
    # If the user input cannot be converted into an integer class,
    # the function restarts with an error reminding the user the answer
    # needs to be an integer. The program asks for a new answer to pass
    # to the function before restarting.
    except ValueError:
        print("\nOops! Make sure you enter an integer.")
        new_answer = input("Enter your new answer: ")
        math_answer_valid(new_answer)