Cash Register challenge help

I am having trouble with only test 3. I suspect this is due to floating point math, but have no idea how to fix it. All other tests pass, but test 3 is off by a penny.

FCC Cash Register link: cash register

My code on Repl.it: repl

My preferred way to handle floating point problems in this challenge is to use an integer number of cents in all your calculations and then convert back to decimal at the end. So, $5 is 500 cents, $20 is 2000 cents, and so on.

1 Like

Thank you very much for your help. A half hour of fumbling through where to convert back and forth later., and all tests pass. Thank you once again for your time.

1 Like