Q:

python exec() with an if statement

I'm trying to find a way to exec() an if statement.
So, for example:
exampleCode = "if 0 < 1:"

exec(exampleCode)
    print("Zero is less than one")

Now, obviously this isn't possible with exec(). But is it with something similar?
Something else that would work would be:
exampleCode = "if 0 < 1:"

exampleCode
    print("Zero is less than one")

Again, this isn't possible, because variables cannot be code.
So, again, is there something else that may work?

A:

You can do this, sort of, with eval:
exampleCode = "0 < 1"
if eval(exampleCode):
    print("Zero is less than one")

...but it's unclear what the benefit is of doing this (that is, there's something you're not showing us that motivates your question).

