In exercise 8 of the Thread Shed project, the code goes as follows to clean up white space from a list of strings we generated in previous steps.
for transaction in daily_transactions_split:
for item in transaction:
I totally get why we need two for loops here. What I am confused about is the reason for the empty list transaction_clean after the first for loop. Why can’t I just directly append the item.strip() result to the empty list transactions_clean??
Is there a rule for when I would need to create a list within the first loop when trying to access an item within a list within a list?
Thank you in advance for the help!