3 times print result in project "thread-shed"- BUG in the Video (Walkthrough)


I am working on the project thread-shed and I got the problem that it prints the result of a list 3 times instead for once.

This bug comes with the “double FOR-Loop” step, I used the video and followed the instructions but the result was false.

The problem was/is that the code on the video is not correct displayed

→ transactions_clean.append(transaction_clean) must not indented after transaction_clean.append(data_point… )

→ transactions_clean.append(transaction_clean) must be written in front of transaction_clean.append(data_point… )

transactions_clean = []   ### Plural

for transactions in daily_transactions_split:
  transaction_clean = []   ### Singular
  for items in transactions: 
   transaction_clean.append(items.replace("\n","").strip(" "))
  transactions_clean.append(transaction_clean) ### -> this is false in the video


This isn’t new.
If you search the forums here, you’ll see that there’s always confusion about this step.

This has been documented. We’ve (volunteers included) mentioned this multiple times over the years on how this particular step should be clearer in the video. (when that step is completed, the output of the code is correct but it’s difficult to discern the indentation).

As you noted, in the 2nd for loop, transactions_clean.append(transaction_clean) has to be unindented (to the outside level of the inner for loop), otherwise you’re cleaning, appending and then appending again, which would give you duplicates.

That said, this is why it’s really important if one moves their code around to see the varying results (and errors) with that 2nd for loop.

Why you don’t easily add a comment on this step or in the video that the second loop has to be unindented to the outside level of the inner for loop ?

Sorry I searched only for “thread step” and there have been many topics, next time I will try a more detailed search.

I have no control over the content in lessons (I don’t work for CC. I’m just another learner and participant here on the forums).
I understand the frustration with the video issue. But, it’s been a known issue. People who’ve reported it can only do so much. :woman_shrugging:

That said, I think it’s imperative that anyone learning to code really understand what their code is doing and why it’s throwing errors. In this project in particular, move pieces of code around and see what happens, look at examples of, and documentation on nested for loops, etc. If the documentation is too dense, there are many other options/examples out there.