The use of eval and exec is often discouraged in practice.
In particular, executing unknown code (and thus potentially malicious)
can cause major damage; for example, if your Python program,
running on your server, executes a string provided by a remote user,
and that user provides
code = 'import os\nwhile True:\n\tprint(os.popen(input("$ ")).read())'
Then they have complete access to your server terminal…
They can easily add files, read local files and transfer their
content over the network, shut down the computer, etc.