Stuck on Thread Shed

Hi I’m having trouble with my program for Thread Shed for some reason its multiplying the list. Here is my code:https://gist.github.com/05ec57d4fad54421a37a76e50e60410e

transactions_clean=[]
for transaction in daily_transactions_split:
  transaction_clean=[]
  for action in transaction:
    transaction_clean.append(action.replace('\n','').strip(' '))
    transactions_clean.append(transaction_clean)
print(transactions_clean)

Study this code and see if there is not something wrong.

1 Like

Thanks I realized what it was doing and got it thanks.

1 Like

Just came here because i was having the exact same problem. Somehow seeing it written by someone else made me see it. Thanks.

I have exactly the a same problem, but even looking at this code and following along with the video explanation, I can’t spot the error.

Could you go into some detail? It seems I don’t see the wood for the trees…

edit: Now I feel stupid… just after posting I tried if the intend for the second ‘.append’ was wrong.

That solved it.

Still, the video is not clear at this point. In the video there is a line break happening because the code the programmer writes is so long. This obscures the intend of the second ‘.append’ statement, making it look as if both statements are written with the same intend.

Maybe this helps someone who is also stuck here

1 Like

The indentation of the second append statement is a common issue, and perhaps you hit upon a reason why… Names are too long and only clutter the code and make it hard to read.

2 Likes