I’m having trouble somewhere in the last few steps. When I try to get through step 22 the output is formatted like
24
Thread Shed sold None threads of red thread today.
even though I was able to get the value for counting white threads a couple of steps before.
Here is my full code just in case:
daily_sales_replaced = daily_sales.replace(“;,;”, “;”)
daily_transactions = daily_sales_replaced.split(“,”)
#print(daily_transactions)
daily_transactions_split =
for line in daily_transactions:
daily_transactions_split.append(line.split(“;”))
#print(daily_transactions_split)
transactions_clean =
for line in daily_transactions_split:
line_clean =
for element in line:
line_clean.append(element.replace(“\n”, “”).strip())
transactions_clean.append(line_clean)
#print(transactions_clean)
customers =
sales =
thread_sold =
for line in transactions_clean:
customers.append(line[0])
sales.append(line[1])
thread_sold.append(line[2])
#print(customers)
#print(sales)
#print(thread_sold)
total_sales = 0
for e in sales:
price = float(e.strip(“$”))
total_sales += price
#print(total_sales)
#print(thread_sold)
thread_sold_split =
for e in thread_sold:
if e.count(“&”) > 0:
e_new = e.split(“&”)
for i in range(len(e_new)):
thread_sold_split.append(e_new[i])
else:
thread_sold_split.append(e)
#print(thread_sold_split)
def color_count(color):
count = 0
for e in thread_sold_split:
if e == color:
count += 1
print(count)
#color_count(“white”)
colors = [“red”, “yellow”, “green”, “white”, “black”, “blue”, “purple”]
for color in colors:
print(“Thread Shed sold {a} threads of {b} thread today.”.format(a = color_count(color), b = color))