Thread Shed - set equal to float => cast str to float


#1

Thread Shed exercise

Code

I think I overlook something very basic, as I am searching the web I don’t get a simple answer that I think will solve it. In the list sales, we need to strip the numbers of $ signs and set them equal to float. After stripping the number, I can’t figure out how to set them equal to float.

Line 14 in the exercise.

14.

Now, consider the list sales . It is a list of strings that we want to sum. In order for us to sum these values, we will have to remove the $ , and set them equal to floats.

Iterate through sales and for each item, strip off the $ , set it equal to a float, and add it to total_sales


#2

set equal to float is a confusing term, i think you should cast to float (data type conversion). That should be easy to find: python cast string to float, or maybe you even know this? Understanding what is asked (even when specifications aren’t very clear) is very important: what i am trying to do here?


#3

I was just thinking to delete this post as I found it.
I stripped the number of $ and set it equal to a variable. that variable x, i can cast to float and add to the variable of total_sales.

I looked up the verb ‘cast’ as I am not familiar with another meaning than casting a cast for a movie.