My Thread Shed Issues

So I’m trying to get through the first round of color_count. The answer, as we were told, is 28. i keep getting zero. can’t see what i’m doing wrong at this point.

here is my code:

def color_count(color):
  color_total = 0
  for thread_color in thread_sold_split:
    if color == thread_color:
     color_total += 1
  return color_total

print(color_count('white'))

any help appreciated

Without seeing the rest of your code, it’s impossible to say what might be wrong. I’d guess that thread_sold_split doesn’t contain what you intended. You could add a print statement or two to see what you are working with:

Thanks that helps. thread_sold_split was actually a list of lists. I split it out incorrectly. Now I get 112 for an answer, but that is better than 0 :slight_smile:

back at it thank you

1 Like