Threead Shed Project Bugged

I am currently working on the thread shed project: https://www.codecademy.com/courses/learn-python-3/projects/thread-shed

I have run into a bug that repeatedly prints everything 4 times in a row, regardless if I write my own code or copy and paste the code directly from the YouTube video given for the project.

I will link my code alongside the result: Thread Shed Bug - Pastebin.com

Welcome to the forums.
What have you tried to correct the issue?

You might want to look at the indentation in your second for loop at this point:

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 way you have it written, you’re cleaning, appending and appending again which would give you the 4x repetition.
When it comes to things like this it’s really helpful to talk out, or write out what the code is doing so you can better understand it.

This is exactly how its typed out on the on the youtube video: Python Project Thread Shed - YouTube

Actually, no, it isn’t. It’s a very slight difference which will have an effect on the output.

This part of your code is not indented correctly:

transactions_clean.append(transaction_clean)

It needs to be on the same level as the for above it. (Have you tried unindenting and indenting the code to see what the results are?)

It should look like this:

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

print(transactions_clean)

transaction_clean.append has to be indented and transactions_clean.append has to be at the outside level of the inner for loop, Otherwise you’re cleaning, appending and then appending again, which would give you the 4 duplicates.

There are also several threads on this very subject in the forums that might be of use.
https://discuss.codecademy.com/search?q=thread%20shed