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:

for transaction in daily_transactions_split:
  for action in transaction:
    transaction_clean.append(action.replace('\n','').strip(' '))

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.