...

/

Puzzle 30: Explanation

Puzzle 30: Explanation

Let’s find out how to use Python’s built-in eval and exec functions.

We'll cover the following...

Try it yourself

Try executing the code below to verify the results:

Press + to interact
a = eval('a = 7')
val = eval('a * 3')
print(val)

Explanation

The built-in eval function reads a Python expression as a string and returns its value.

We tend to split the code ...

Access this course and 1400+ top-rated courses and projects.