Thread-shed making 4 copies of each of the lists

Link is here:

Somewhere around step 8 or 9 something happens and I suddenly have 4 of each list.
print statement looks like this for each list:
[[‘Edith Mcbride’, ‘$1.21’, ‘white’, ‘09/15/17’],
[‘Edith Mcbride’, ‘$1.21’, ‘white’, ‘09/15/17’],
[‘Edith Mcbride’, ‘$1.21’, ‘white’, ‘09/15/17’],
[‘Edith Mcbride’, ‘$1.21’, ‘white’, ‘09/15/17’],

Here is my code up to this point:

Start coding below!


daily_transactions_split =
for transaction in daily_transactions:

transactions_clean =
for transaction in daily_transactions_split:
transaction_clean =
for data_point in transaction:
transaction_clean.append(data_point.replace(’\n’, ‘’).strip(’ '))


I feel like it could be an indentation thing with the for loop so it is appending it 4 times but it looks exactly like the video and it works in the video… please help :slight_smile:

Hello @a_dam_rut, welcome to the forums!

This thread may be of help. Essentially, the last loop is looping through transaction four times, and as such is creating four times too many lists. You are indeed correct in your assumption that indentation is the issue. Look at this line, and consider its indentation:


This thread may also help.

Also, in future, please make sure to format your code according to this guide; thanks!

1 Like

Thank you! that fixed the issue. I was suspecting that it was an indentation error on that line. I was so close!

1 Like