Thread Shed 12/22


#1

Thread Shead exercise

currently at the task 12 and when i print either of the last print statements all i get is

#[‘Edith Mcbride’, ‘$1.21’, ‘white’, ‘09/15/17’]

over and over again, i’ve checked out the video walkthrough codes are very similar besides some temp variables can someone help me out got stuck on this exercise

#Start coding below!

daily_sales_replaced = daily_sales.replace(";,;", "+")
daily_transactions = daily_sales_replaced.split(",")
#print(daily_transactions)

daily_transactions_split = []

for trans in daily_transactions:
  daily_transactions_split.append(trans.split("+"))
  
#print(daily_transactions_split)

transactions_clean = []

for trans in daily_transactions_split:
  trans_clean = []
  for data in trans:
    trans_clean.append(data.replace("\n", "").strip(" "))
    transactions_clean.append(trans_clean)
    
#print(transactions_clean)
    
customers = []
sales = []
thread_sold = []

for data in transactions_clean:
  customers.append(transactions_clean[0])
  sales.append(transactions_clean[1])
  thread_sold.append(transactions_clean[2])
  
#print(customers)
#print(sales)
#print(thread_sold)

#2

That line should not be inside the inner loop.

We can chain .replace() and write it in the first line of the program…

daily_sales_replaced = daily_sales.replace(';,;',';').replace('\n', '')

so your line becomes,

trans_clean.append(data.strip())