Hello! I’m currently working through the thread shed project and hitting a road bump on step 14 where I am tasked with iterating through sales and adding the sales totals together after removing the “$”. My code for this step looks the same as what I’ve seen in other solutions but I am getting an AttributeError: ‘list’ object has no attribute ‘strip’. Is there something wrong with a previous line in my code maybe?
Step 2, replacing “”;,;“” with another symbol to avoid issues when splitting with “,”
‘’’
daily_sales_replaced = daily_sales.replace(“;,;”, “+”)
print(daily_sales_replaced)
‘’’
Step 3, splitting the string into a list of each transaction based around “,”
daily_transactions = daily_sales_replaced.split(“,”)
print(daily_transactions)
Step 5-7, splitting each individual transaction into a list of its data
daily_transactions_split =
for transaction in daily_transactions:
daily_transactions_split.append(transaction.split(“+”))
print(daily_transactions_split)
Step 8-9, remove white space from each individual transaction and append to new list
transactions_clean =
for transaction in daily_transactions_split:
transactions =
for individual in transaction:
transactions.append(individual.split())
transactions_clean.append(transactions)
print(transactions_clean)
Step 10, creating 3 empty lists
customers =
sales =
thread_sold =
Step 11, iterating through transactions_clean and appending to empty lists
for items in transactions_clean:
customers.append(items[0])
sales.append(items[1])
thread_sold.append(items[2])
print(customers)
print(sales)
print(thread_sold)
Steps 13-14, iterating through sales to remove “$” and add to total_sales
total_sales = 0
for sale in sales:
total_sales += float(sale.strip(“$”))
‘’’