Thread Shed error

https://www.codecademy.com/courses/learn-python-3/projects/thread-shed

I have an error message that I don’t understand . In this case the message says " trace back (most recent call last):
File “script.py”, line 110, in
daily_sales_replaced = daily_sales.daily_sales.replace(";,;","+")
Attribute Error: ‘str’ object has no attribute ‘daily_sales’"

What does it mean exactly? Attribute Error: ‘str’ object has no attribute ‘daily_sales’" .

Am I missing something in the code?

Thanks in advance.

Hi.
you’ve got daily_sales.daily_sales.replace…
So, it’s thinking the second daily_sales is an attribute of the first and can’t work out what it’s supposed to be doing.
delete the extra daily_sales. and you should be ok.

Have fun

Yes indeed that suggestion worked

I have an error mesaage on line 141

  File "script.py", line 141, in <module>
    total_sales += float(sale.strip("$"))
ValueError: could not convert string to float: 'y```

Which I don't understand is it a syntax error or the semantics of the code?

That error means that, on line 141, you’re trying to convert a string that contains something other than numbers or a single decimal, into a float. For example:

strng = "123h"
print(float(strng))

Will throw the same error as yours, since "h" cannot be turned into a float.


  total_sales += float(sale.strip("$"))

print(total_sales)```

would the code   total_sales += float(sale.strip("$"))       not strip "$" and leave only the float?  Or is the construction of the code itself unworkable?

I’m afraid I don’t know the state of the code before the .strip($), but that’s what I imagine’s going on. Your code seems workable; there may just be some space or something that’s causing the error.

yes that’s right the code is working perhaps it is a space or something.

1 Like

Traceback (most recent call last):
File “script.py”, line 141, in
total_sales += str(sale.strip(“$”))
AttributeError: ‘list’ object has no attribute ‘strip’

i need help i have checked the video to try and pin point the problem its identical code yet not working why.

Please post your formatted code so people can help you debug it.

Also, this guide might be of some help:

And this one too. Particularly the Do’s and Don’ts section: