exercise link:
https://www.codecademy.com/paths/computer-science/tracks/cspath-python-objects/modules/cspath-python-strings/projects/thread-shed
transactions_clean = []
for tr in daily_transactions_split:
for space in range(len(tr)):
tr[space] = tr[space].strip()
transactions_clean.append(tr)
customers = []
sales = []
thread_sold = []
for trans in transactions_clean:
if trans[0] in trans:
name = trans[0]
customers.append(name)
for sale in transactions_clean:
if sale[1] in sale:
price = sale[1]
sales.append(price)
for thread in transactions_clean:
if thread[2] in thread:
thread_type = thread[2]
thread_sold.append(thread_type)
When I print my individual lists to the console, the individual lists print out a list of each name, sale, and thread four times in what seems like an almost never ending repetition of the individual lists.
['white', 'white', 'white', 'white', 'white&blue', 'white&blue',
'white&blue', 'white&blue', 'white&blue', 'white&blue', 'white&blue',
'white&blue', 'white', 'white', 'white', 'white', 'white&yellow',
'white&yellow', 'white&yellow', .....]```
Not sure if this is caused by the previous transaction_clean code where each individual transaction was stripped of it’s white space and placed into individual transactions lists, but the lists were repeated three times.
[['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'],
I am fairly sure this was not the intended output for the desired code and was wondering if anyone can help point me in the write direction.