I was able to figure out everything up to #18, however I can’t figure out how to work on #19.
- Great, now we have a list
thread_sold_splitthat contains an entry with the color of every thread sold today.
Define a function called
color_count that takes one argument,
color. The function should iterate through
thread_sold_split and count the number of times the item is equal to argument,
color. Then, it should return this count.
- Test your new function by running
Your function should return
here is my code.
for color in thread_sold:
if “&” not in color:
count = 0
for thread in thread_sold_split:
for c in thread:
if c == color:
why is my output 22 instead of 26 ??? can anyone explain?