August 2021
Beginner to intermediate
118 pages
1h 29m
English
| Puzzle 9 | A Simple Math |
| | print(1.1 * 1.1) |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: 1.2100000000000002
You might have expected 1.21, which is the right mathematical answer.
Some new developers, when seeing this or similar output, come to the message boards and say, “We found a bug in Python!” The usual answer is, “Read the fine manual” (or RTFM for short).
Floating point is sort ...
Read now
Unlock full access