Open this example in the interactive library
Source code
from math import isclose
print(isclose(0.1 + 0.2, 0.3))Sample output
True

Compare approximate values. A self-contained example using the Python standard library.
Open this example in the interactive library
from math import isclose
print(isclose(0.1 + 0.2, 0.3))True