Challenge: Thread Shed = there is an issue not allowing me to move forward with the lesson

For the challenge “Thread Shed” I cannot get past step 8. I have clicked on the “Get Unstuck” and then on “Project Walkthrough” and then did what the video did up to the 7min 15sec mark where it has you print(transactions_clean). At that point in the video, the teacher gets back his data with the whitespaces removed. When I follow those exact instructions I get back an empty list as “” and that’s it.

Here is my code up to that point, the same code the instructor uses in the video:

daily_sales_replaced = daily_sales.replace(";,;", "+") 

daily_transactions = daily_sales_replaced.split(",")

# print(daily_transactions)

daily_transactions_split = []

for transaction in daily_transactions:

  daily_transactions_split.append(transaction.split("+"))

# print(daily_transactions_split)

transactions_clean = []

for transaction in daily_transactions_split:

  transaction = []

  for data_point in transaction:

    transaction_clean.append(data_point.strip(" "))

    transactions_clean.append(transaction_clean)

print(transactions_clean)

I cannot move further as I am unable to get the results needed to progress further with later steps. Please help and thank you.

Can you please format your code? (Use the </> button above)

It’s difficult to tell from what you’ve posted b/c Python relies on indentation.

used the </> button as requested lisalisaj :slight_smile:

in the workbook, it doesn’t have a space between each line, that just happens when you copy-paste. here is what it looks like really:

issue

this line is the issue:
transactions_clean.append(transaction_clean)

You need to unindent it to the same level as the inner for loop.
Otherwise, your code as you have it written is cleaning, appending and appending again.

You can also find this discussion here:
https://discuss.codecademy.com/search?q=thread%20shed%20step%208

I tried what you suggested, see screenshot attached and now I get the error shown:

Check the spelling on line 121

You called the empty list “transaction”, not “transaction_clean”

I fixed those two issues and now I think we are getting close but still not the same results as the video. see my screenshot. My return has allot of duplicates where the videos does not?

Here is my code updated:

daily_sales_replaced = daily_sales.replace(";,;", "+") 
daily_transactions = daily_sales_replaced.split(",")
# print(daily_transactions)

daily_transactions_split = []
for transaction in daily_transactions:
  daily_transactions_split.append(transaction.split("+"))
# print(daily_transactions_split)

transactions_clean = []
for transaction in daily_transactions_split:
  transaction_clean = []
  for data_point in transaction:
    transaction_clean.append(data_point.strip(" "))
    transactions_clean.append(transaction_clean)
print(transactions_clean)

The last line needs to be outdented a couple spaces.

Now were cooking with grease, thank you all very much for your help.

1 Like