Thread Shed Project: Why does this code work when using an empty list and not a variable?

https://www.codecademy.com/courses/learn-python-3/projects/thread-shed

for tran in daily_transactions_split:
  boop = []
  for ting in tran:
    boop.append(ting.replace("\n", "").strip(" "))
  transactions_clean.append(boop)

Hello @h1lo, welcome to the forums! The empty list is still a variable. The reason you reset it to [] for every

iteration is that you are using it as a means to collect certain information, and append that to something else as a single item. If you didn’t reset it, you would get the same things appended to transactions_clean time after time.

2 Likes