Suppose I have this code: but I only get this error: NameError: name ‘math’ is not defined How can I fix this? Answer The second parameter to eval, if present, should reference the global namespace. Here, you explicitely assigned an empty dict to it, so you don’t have any access to the name math of the global namespace. You could