I don't think I did this part of "thread shed" in the python 3 course in the proper manner

Here is my code up until the point I think I did something weird in this exercise:


daily_sales_replaced = daily_sales.replace(";,;", ";")


daily_transactions = daily_sales_replaced.split(",")


daily_transactions_split = []

for i in range(len(daily_transactions)):

  splitted = daily_transactions[i].split(";")



transactions_clean = []

for index in range(len(daily_transactions_split)):

  for words in daily_transactions_split[index]:

    spliited = words.strip()



customers = []

sales = []

thread_sold = []

for index in range(len(transactions_clean)):

  if index % 4 == 0:


  elif (index - 1) % 4 == 0:


  elif (index - 2) % 4 == 0:


The output of transactions_clean was not a 2d list. I got the impression after reading through my tasks that it was meant to be a 2d list with a name, sale, colour thread and date each in its own separate list inside the 2d list.

As it turns out I was fine and managed to get the lists for customers, sales, and threads sold correct anyway. But I’m just wondering now after finishing the exercise how I would have simultaneously made a list which cleaned up daily_transactions_split with strip() and preserved the 2d nature of daily_transactions_split.

Thanks in advance

While it is certainly possible, it would be very convoluted and require extra logic, and process time. Simplifying the list, then splitting into the three is simple and straight forward.