practicepython.in
python exercises
171 exercises

Daily #23 · 21 October 2026

Thirty pence Easy

What does this print?

print(0.1 + 0.2 == 0.3)
  1. A0.30000000000000004
  2. BTrue
  3. CFalse
  4. Draises ValueError
Show the answer

C: False

Why: 0.1 has no exact binary form, just as 1/3 has no exact decimal one, so the sum lands a hair away from 0.3. Compare money with math.isclose, or keep it in whole pence.

Play today’s puzzle →