Please help, this is driving me up the wall! I have watched the video walk-through and have applied the code the same but I get 4 print versions, I can see others have had the same issue but I can’t see any responses that clarify what is going on to cause this. Does it affect the rest of the project or is it just a side-affect of the print function due to the iterations in the loop? The previous step only prints one of each item.
My code is below:
daily_sales_replaced = daily_sales.replace(“;,;”, “~” )
daily_transactions = daily_sales_replaced.split(“,”)
#print(daily_transactions) worked but lots of \n
for item in daily_transactions:
#print(daily_transactions_split) #split with lots of whitespace.
for transaction in daily_transactions_split:
for data_point in transaction:
transaction_clean.append(data_point.replace(“\n”, “”).strip(" "))
print(transactions_clean) #why does this print 4 iterations of each one?!?!