5/28
Part 1 of 7 · Floats to centsLearn and do

Decimal is exact only when you give it text

The decimal module can hold 0.29 exactly, but only if you hand it the digits as text:

print(Decimal(0.29))
print(int(Decimal(0.29) * 100))
print(int(Decimal("0.29") * 100))
Predict

What do int(Decimal(0.29) * 100) and int(Decimal("0.29") * 100) give?

Pick one to see what it prints.
Pick an answer above to see the rest