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('$'))
print(num)
total_sales = total_sales + num
print(total_sales)
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?