Thread Shed project: help w/ possible bug?

Hey!

I started the ‘Thread Shed’ python string methods project and ran into a problem. I was getting along fine until about step 13 I noticed that (after i printed the function to check result) the cleaned list for transactions i did about 4 steps ago was creating about 4-5 copies of every transaction sort of like this

'09/15/17'], ['Terrell Barber', '$9.91', 'green', '09/15/17'], ['Terrell Barber', '$9.91', 'green', '09/15/17'], ['Terrell Barber', '$9.91', 'green', '09/15/17'], ['Terrell Barber', '$9.91', 'green', '09/15/17'], ['Jody Flores', '$16.34', 'green', '09/15/17'], ['Jody Flores', '$16.34', 'green', '09/15/17'], ['Jody Flores', '$16.34', 'green', '09/15/17'], ['Jody Flores', '$16.34', 'green', 

soooo I deleted the function thinking i did something wrong, tried going over it a few times, replacing and rewriting things i knew were correct and even went as far as to copy the developer-in-the-video’s code line for line. still the same result. below is what i have currently…no error just a ridiculous amount of data in the console lol.


daily_sales_1 = daily_sales.replace(";,;", ";")
daily_transactions = daily_sales_1.split(",")

daily_transactions_split = []
for transaction in daily_transactions:
  daily_transactions_split.append(transaction.split(";"))

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

sorry if this post is too long i don’t post on forums often so i don’t really know the etiquette, let me know if anyone has an idea about what might be wrong. thanks!

project link: https://www.codecademy.com/paths/computer-science/tracks/cspath-python-objects/modules/cspath-python-strings/projects/thread-shed

The second line should not be inside the same loop as the first.

1 Like

gosh darn indentation, lol.

thanks that fixed it. now i feel like an idiot :sweat_smile:

1 Like