Simple arithmetic game in Python
Quick comment: If you have code which is supposed to run when you call the script (in your case its the "run the game" part of the code), its good practice to put it in a main() function and call the main function rather than keep all that code at the highest level of the file. At the bottom of the file, it would look something like this:

def main():
    functions_to_play_math_game()

if __name__ == "__main__":
    main()


When a python script runs, it gets a __name__ attribute depending on how it was called. If it was run through the command line (with $ python my_script.py), the __name__ attribute gets set to "__main__". So the second part of my code sample checks if the __name__ attribute indicates the script is being called to run, and if so, executes the code inside main().

The reason this is important is because when you import a module in python, it runs all the code inside that file. Now, if the file only contains function definitions, nothing out of the ordinary happens. But if you imported your file into another file, at the import my_file line your game would start running because there is no safeguard to prevent it from going. The catch is that when being imported, __name__ is not set to __main__ like it is when you call the script from a command line. So, if you have this safeguard at the bottom of your code, it wont run when its imported.