August 2021
Beginner to intermediate
118 pages
1h 29m
English
| Puzzle 30 | Highly Valued |
| | a = eval('a = 7') |
| | val = eval('a * 3') |
| | print(val) |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will raise a SyntaxError exception.
The eval built-in function takes a Python expression as a string and returns its value.
We tend to split the code into two categories:
An expression is something that has a value (e.g., 5 / 7, 1 < 3).
A statement ...
Read now
Unlock full access