Thread Shed bug?

I finished the Thread Shed project successfully, but was confused at step 14.

My code is as follows:

sales = ["$5.67", "$67.4", "$3.75"]
total_sales = 0
for i in sales:
  num = float(i.strip('$'))
  total_sales = total_sales + num

The exercise makes you iterate through a list of strings that need to be converted to floats and add it to total_sales. This code, for example, prints the clean floats and adds them to total_sales. But once you print total_sales, it prints “76.82000000000001”, which is a weird way of just saying “76.82”. It doesnt really affect my code in anyway, but my OCD is driving me nuts with this. Is there a way to solve this?

Hello, @warmslicedbread, and Happy Birthday!

You may not be familiar with this syntax, but try:


You can read about it here:
You’ll have to scroll down a ways to find it.
Happy coding!

1 Like

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.