What is printed?
print(0.1 + 0.2 == 0.3, round(0.1 + 0.2, 2) == 0.3)
- False True
- True True
- False False
- True False
Binary floats make the raw sum slightly off; rounding to 2 places fixes the comparison.
Play Problem Solving ▸
print(0.1 + 0.2 == 0.3, round(0.1 + 0.2, 2) == 0.3)