Thread Shed

On the project “Thread Shed” in the strings module for python, I was following the step by step youtube video, and somehow, when printing the sum of all the sales, I got x4 the expected value. I looked through the code to see if it was a minor error but I couldn’t spot it. I tried restarting from scratch and it still didn’t work. If you print “Sales,” it prints each number four times.

daily_sales =
“”“Edith Mcbride ;,;$1.21 ;,; white ;,;
09/15/17 ,Herbert Tran ;,; $7.29;,;
white&blue;,; 09/15/17 ,Paul Clarke ;,;$12.52
;,; white&blue ;,; 09/15/17 ,Lucille Caldwell
;,; $5.13 ;,; white ;,; 09/15/17,
Eduardo George ;,;$20.39;,; white&yellow
;,;09/15/17 , Danny Mclaughlin;,;$30.82;,;
purple ;,;09/15/17 ,Stacy Vargas;,; $1.85 ;,;
purple&yellow ;,;09/15/17, Shaun Brock;,;
$17.98;,;purple&yellow ;,; 09/15/17 ,
Erick Harper ;,;$17.41;,; blue ;,; 09/15/17,
Michelle Howell ;,;$28.59;,; blue;,; 09/15/17 ,
Carroll Boyd;,; $14.51;,; purple&blue ;,;
09/15/17 , Teresa Carter ;,; $19.64 ;,;
white;,;09/15/17 , Jacob Kennedy ;,; $11.40
;,; white&red ;,; 09/15/17, Craig Chambers;,;
$8.79 ;,; white&blue&red ;,;09/15/17 , Peggy Bell;,; $8.65 ;,;blue ;,; 09/15/17, Kenneth Cunningham ;,; $10.53;,; green&blue ;,;
09/15/17 , Marvin Morgan;,; $16.49;,;
green&blue&red ;,; 09/15/17 ,Marjorie Russell
;,; $6.55 ;,; green&blue&red;,; 09/15/17 ,
Israel Cummings;,; $11.86 ;,;black;,;
09/15/17, June Doyle ;,; $22.29 ;,;
black&yellow ;,;09/15/17 , Jaime Buchanan ;,;
$8.35;,; white&black&yellow ;,; 09/15/17,
Rhonda Farmer;,;$2.91 ;,; white&black&yellow
;,;09/15/17, Darren Mckenzie ;,;$22.94;,;green
;,;09/15/17,Rufus Malone;,;$4.70 ;,; green&yellow
;,; 09/15/17 ,Hubert Miles;,; $3.59
;,;green&yellow&blue;,; 09/15/17 , Joseph Bridges ;,;$5.66 ;,; green&yellow&purple&blue
;,; 09/15/17 , Sergio Murphy ;,;$17.51 ;,;
black ;,; 09/15/17 , Audrey Ferguson ;,;
$5.54;,;black&blue ;,;09/15/17 ,Edna Williams ;,;
$17.13;,; black&blue;,; 09/15/17, Randy Fleming;,; $21.13 ;,;black ;,;09/15/17 ,Elisa Hart;,; $0.35 ;,; black&purple;,; 09/15/17 ,
Ernesto Hunt ;,; $13.91 ;,; black&purple ;,;
09/15/17, Shannon Chavez ;,;$19.26 ;,;
yellow;,; 09/15/17 , Sammy Cain;,; $5.45;,;
yellow&red ;,;09/15/17 , Steven Reeves ;,;$5.50
;,; yellow;,; 09/15/17, Ruben Jones ;,;
$14.56 ;,; yellow&blue;,;09/15/17 , Essie Hansen;,; $7.33 ;,; yellow&blue&red
;,; 09/15/17 , Rene Hardy ;,; $20.22 ;,;
black ;,; 09/15/17 , Lucy Snyder ;,; $8.67
;,;black&red ;,; 09/15/17 ,Dallas Obrien ;,;
$8.31;,; black&red ;,; 09/15/17, Stacey Payne
;,; $15.70 ;,; white&black&red ;,;09/15/17
, Tanya Cox ;,; $6.74 ;,;yellow ;,;
09/15/17 , Melody Moran ;,; $30.84
;,;yellow&black;,; 09/15/17 , Louise Becker ;,;
$12.31 ;,; green&yellow&black;,; 09/15/17 ,
Ryan Webster;,;$2.94 ;,; yellow ;,; 09/15/17
,Justin Blake ;,; $22.46 ;,;white&yellow ;,;
09/15/17, Beverly Baldwin ;,; $6.60;,;
white&yellow&black ;,;09/15/17 , Dale Brady
;,; $6.27 ;,; yellow ;,;09/15/17 ,Guadalupe Potter ;,;$21.12 ;,; yellow;,; 09/15/17 ,
Desiree Butler ;,;$2.10 ;,;white;,; 09/15/17
,Sonja Barnett ;,; $14.22 ;,;white&black;,;
09/15/17, Angelica Garza;,;$11.60;,;white&black
;,; 09/15/17 , Jamie Welch ;,; $25.27 ;,;
white&black&red ;,;09/15/17 , Rex Hudson
;,;$8.26;,; purple;,; 09/15/17 , Nadine Gibbs
;,; $30.80 ;,; purple&yellow ;,; 09/15/17 ,
Hannah Pratt;,; $22.61 ;,; purple&yellow
;,;09/15/17,Gayle Richards;,;$22.19 ;,;
green&purple&yellow ;,;09/15/17 ,Stanley Holland
;,; $7.47 ;,; red ;,; 09/15/17 , Anna Dean;,;$5.49 ;,; yellow&red ;,; 09/15/17 ,
Terrance Saunders ;,; $23.70 ;,;green&yellow&red
;,; 09/15/17 , Brandi Zimmerman ;,; $26.66 ;,;
red ;,;09/15/17 ,Guadalupe Freeman ;,; $25.95;,;
green&red ;,; 09/15/17 ,Irving Patterson
;,;$19.55 ;,; green&white&red ;,; 09/15/17 ,Karl Ross;,; $15.68;,; white ;,; 09/15/17 , Brandy Cortez ;,;$23.57;,; white&red ;,;09/15/17,
Mamie Riley ;,;$29.32;,; purple;,;09/15/17 ,Mike Thornton ;,; $26.44 ;,; purple ;,; 09/15/17,
Jamie Vaughn ;,; $17.24;,;green ;,; 09/15/17 ,
Noah Day ;,; $8.49 ;,;green ;,;09/15/17
,Josephine Keller ;,;$13.10 ;,;green;,; 09/15/17 , Tracey Wolfe;,;$20.39 ;,; red ;,; 09/15/17 ,
Ignacio Parks;,;$14.70 ;,; white&red ;,;09/15/17
, Beatrice Newman ;,;$22.45 ;,;white&purple&red
;,; 09/15/17, Andre Norris ;,; $28.46 ;,;
red;,; 09/15/17 , Albert Lewis ;,; $23.89;,;
black&red;,; 09/15/17, Javier Bailey ;,;
$24.49 ;,; black&red ;,; 09/15/17 , Everett Lyons ;,;$1.81;,; black&red ;,; 09/15/17 ,
Abraham Maxwell;,; $6.81 ;,;green;,; 09/15/17
, Traci Craig ;,;$0.65;,; green&yellow;,;
09/15/17 , Jeffrey Jenkins ;,;$26.45;,;
green&yellow&blue ;,; 09/15/17, Merle Wilson
;,; $7.69 ;,; purple;,; 09/15/17,Janis Franklin
;,;$8.74 ;,; purple&black ;,;09/15/17 ,
Leonard Guerrero ;,; $1.86 ;,;yellow
;,;09/15/17,Lana Sanchez;,;$14.75 ;,; yellow;,;
09/15/17 ,Donna Ball ;,; $28.10 ;,;
yellow&blue;,; 09/15/17 , Terrell Barber ;,;
$9.91 ;,; green ;,;09/15/17 ,Jody Flores;,;
$16.34 ;,; green ;,; 09/15/17, Daryl Herrera
;,;$27.57;,; white;,; 09/15/17 , Miguel Mcguire;,;$5.25;,; white&blue ;,; 09/15/17 ,
Rogelio Gonzalez;,; $9.51;,; white&black&blue
;,; 09/15/17 , Lora Hammond ;,;$20.56 ;,;
green;,; 09/15/17,Owen Ward;,; $21.64 ;,;
green&yellow;,;09/15/17,Malcolm Morales ;,;
$24.99 ;,; green&yellow&black;,; 09/15/17 ,
Eric Mcdaniel ;,;$29.70;,; green ;,; 09/15/17
,Madeline Estrada;,; $15.52;,;green;,; 09/15/17
, Leticia Manning;,;$15.70 ;,; green&purple;,;
09/15/17 , Mario Wallace ;,; $12.36 ;,;green ;,;
09/15/17,Lewis Glover;,; $13.66 ;,;
green&white;,;09/15/17, Gail Phelps ;,;$30.52
;,; green&white&blue ;,; 09/15/17 , Myrtle Morris
;,; $22.66 ;,; green&white&blue;,;09/15/17"”"

#------------------------------------------------

Start coding below!

daily_sales_replaced = daily_sales.replace(’;,;’, ‘+’)
daily_transactions = daily_sales_replaced.split(’,’)

daily_transactions_split =
for transaction in daily_transactions:
daily_transactions_split.append(transaction.split("+"))

transactions_clean =
for transaction in daily_transactions_split:
transaction_clean =
for data_point in transaction:

transaction_clean.append(data_point.replace("\n", "").strip(" "))
transactions_clean.append(transaction_clean)

customers =
sales =
thread_sold =

for transaction in transactions_clean:
customers.append(transaction[0])
sales.append(transaction[1])
thread_sold.append(transaction[2])

#print(customers)
print(sales)
#print(thread_sold)

total_sales = 0

for sale in sales:
total_sales += float(sale.strip(’$’))

print(total_sales)

Hello! I believe the problem is coming from this loop:

Here, you loop through each transaction in daily_transaction_split. Here, transaction is actually a list which contains 4 elements. That means this loop:

Actually runs 4 times.

Thank you for your consideration. I went through it again this morning and followed the youtube video and got the same error that the instructor didn’t appear to be getting.

I attached a photo of the youtube guided tutorial.

Forget about the video for the moment and double check the guidance above. If you don’t understand why your code is repeating then you need to start breaking down this code into smaller chunks until you can work out what is causing your issue. Just copy/pasting from someone else’s solution is never ideal and is unlikely to be an effective way of learning.

Information in the previous post tells you where to find the problem and even what the issue is. Have a very close look at this section and try to determine why your output is repeating more often that you want it to.

2 Likes

I got an explanation for the problem, which helps but I didn’t get any help with a solution. I understand the steps of iterating through a new list but I’m clueless as to what I should put there now in order to make it work. I’m trying not to copy the instructor but I was just confused because his output was different from mine despite having the same input and I wanted to know why and maybe what I could replace it with to make it work. That way I can fully grasp the concept.

Could you post the code you are currently working on? Make sure to preserve your code’s original formatting by placing it between otherwise blank lines with 3 back ticks on each line like so:

```
code goes here
```

Without seeing your indentation, we’re left to guess what is or isn’t included in any of your loops.
Generally, though, as has been pointed out above by @codeneutrino & @tgrtim, if you have 4 of something that you only wanted 1 of, you probably have something inside a loop that belongs outside of it.

2 Likes

That makes sense how it would print duplicates if the order of the loop isn’t on point. I just went through it once more and it worked. I’m not sure what exactly hat the. problem was. I think it might’ve had to do with parenthesis facing the wrong way.


daily_sales_replaced = daily_sales.replace(';,;', '+')
daily_transactions = daily_sales_replaced.split('+')

daily_transactions_split = []
for transaction in daily_transactions: 
  daily_transactions_split.append(transaction.split("+"))

transactions_clean = []
for transaction in daily_transactions_split:
  transaction_clean = []
  for data_point in transaction:
    transaction_clean.append(data_point.strip(" "))
    transactions_clean.append(transaction_clean)
print(transactions_clean)

OUTPUT :
[[‘Edith Mcbride’], [’$1.21’], [‘white’], [’\n09/15/17 ,Herbert Tran’], [’$7.29’], [’\nwhite&blue’], [‘09/15/17 ,Paul Clarke’], [’$12.52 \n’], [‘white&blue’], [‘09/15/17 ,Lucille Caldwell \n’], [’$5.13’], [‘white’], [‘09/15/17,\nEduardo George’], [’$20.39’], [‘white&yellow \n’], [‘09/15/17 , Danny Mclaughlin’], [’$30.82’], [’\npurple’], [‘09/15/17 ,Stacy Vargas’], [’$1.85’], [’\npurple&yellow’], [‘09/15/17, Shaun Brock’], [’\n$17.98’], [‘purple&yellow’], [‘09/15/17 , \nErick Harper’], [’$17.41’], [‘blue’], [‘09/15/17, \nMichelle Howell’], [’$28.59’], [‘blue’], [‘09/15/17 , \nCarroll Boyd’], [’$14.51’], [‘purple&blue’], [’\n09/15/17 , Teresa Carter’], [’$19.64’], [’\nwhite’], [‘09/15/17 , Jacob Kennedy’], [’$11.40 \n’], [‘white&red’], [‘09/15/17, Craig Chambers’], [’\n$8.79’], [‘white&blue&red’], [‘09/15/17 , Peggy Bell’], [’$8.65’], [‘blue’], [‘09/15/17, Kenneth Cunningham’], [’$10.53’], [‘green&blue’], [’\n09/15/17 , Marvin Morgan’], [’$16.49’], [’\ngreen&blue&red’], [‘09/15/17 ,Marjorie Russell \n’], [’$6.55’], [‘green&blue&red’], [‘09/15/17 ,\nIsrael Cummings’], [’$11.86’], [‘black’], [’\n09/15/17, June Doyle’], [’$22.29’], [’\nblack&yellow’], [‘09/15/17 , Jaime Buchanan’], [’\n$8.35’], [‘white&black&yellow’], [‘09/15/17, \nRhonda Farmer’], [’$2.91’], [‘white&black&yellow \n’], [‘09/15/17, Darren Mckenzie’], [’$22.94’], [‘green \n’], [‘09/15/17,Rufus Malone’], [’$4.70’], [‘green&yellow \n’], [‘09/15/17 ,Hubert Miles’], [’$3.59 \n’], [‘green&yellow&blue’], [‘09/15/17 , Joseph Bridges’], [’$5.66’], [‘green&yellow&purple&blue \n’], [‘09/15/17 , Sergio Murphy’], [’$17.51’], [’\nblack’], [‘09/15/17 , Audrey Ferguson’], [’\n$5.54’], [‘black&blue’], [‘09/15/17 ,Edna Williams’], [’\n$17.13’], [‘black&blue’], [‘09/15/17, Randy Fleming’], [’$21.13’], [‘black’], [‘09/15/17 ,Elisa Hart’], [’$0.35’], [‘black&purple’], [‘09/15/17 ,\nErnesto Hunt’], [’$13.91’], [‘black&purple’], [’\n09/15/17, Shannon Chavez’], [’$19.26’], [’\nyellow’], [‘09/15/17 , Sammy Cain’], [’$5.45’], [’\nyellow&red’], [‘09/15/17 , Steven Reeves’], [’$5.50 \n’], [‘yellow’], [‘09/15/17, Ruben Jones’], [’\n$14.56’], [‘yellow&blue’], [‘09/15/17 , Essie Hansen’], [’$7.33’], [‘yellow&blue&red\n’], [‘09/15/17 , Rene Hardy’], [’$20.22’], [’\nblack’], [‘09/15/17 , Lucy Snyder’], [’$8.67 \n’], [‘black&red’], [‘09/15/17 ,Dallas Obrien’], [’\n$8.31’], [‘black&red’], [‘09/15/17, Stacey Payne \n’], [’$15.70’], [‘white&black&red’], [‘09/15/17 \n, Tanya Cox’], [’$6.74’], [‘yellow’], [’\n09/15/17 , Melody Moran’], [’$30.84 \n’], [‘yellow&black’], [‘09/15/17 , Louise Becker’], [’\n$12.31’], [‘green&yellow&black’], [‘09/15/17 ,\nRyan Webster’], [’$2.94’], [‘yellow’], [‘09/15/17 \n,Justin Blake’], [’$22.46’], [‘white&yellow’], [’\n09/15/17, Beverly Baldwin’], [’$6.60’], [’\nwhite&yellow&black’], [‘09/15/17 , Dale Brady \n’], [’$6.27’], [‘yellow’], [‘09/15/17 ,Guadalupe Potter’], [’$21.12’], [‘yellow’], [‘09/15/17 , \nDesiree Butler’], [’$2.10’], [‘white’], [‘09/15/17 \n,Sonja Barnett’], [’$14.22’], [‘white&black’], [’\n09/15/17, Angelica Garza’], [’$11.60’], [‘white&black \n’], [‘09/15/17 , Jamie Welch’], [’$25.27’], [’\nwhite&black&red’], [‘09/15/17 , Rex Hudson \n’], [’$8.26’], [‘purple’], [‘09/15/17 , Nadine Gibbs \n’], [’$30.80’], [‘purple&yellow’], [‘09/15/17 , \nHannah Pratt’], [’$22.61’], [‘purple&yellow \n’], [‘09/15/17,Gayle Richards’], [’$22.19’], [’\ngreen&purple&yellow’], [‘09/15/17 ,Stanley Holland \n’], [’$7.47’], [‘red’], [‘09/15/17 , Anna Dean’], [’$5.49’], [‘yellow&red’], [‘09/15/17 ,\nTerrance Saunders’], [’$23.70’], [‘green&yellow&red \n’], [‘09/15/17 , Brandi Zimmerman’], [’$26.66’], [’\nred’], [‘09/15/17 ,Guadalupe Freeman’], [’$25.95’], [’\ngreen&red’], [‘09/15/17 ,Irving Patterson \n’], [’$19.55’], [‘green&white&red’], [‘09/15/17 ,Karl Ross’], [’$15.68’], [‘white’], [‘09/15/17 , Brandy Cortez’], [’$23.57’], [‘white&red’], [‘09/15/17, \nMamie Riley’], [’$29.32’], [‘purple’], [‘09/15/17 ,Mike Thornton’], [’$26.44’], [‘purple’], [‘09/15/17, \nJamie Vaughn’], [’$17.24’], [‘green’], [‘09/15/17 , \nNoah Day’], [’$8.49’], [‘green’], [‘09/15/17 \n,Josephine Keller’], [’$13.10’], [‘green’], [‘09/15/17 , Tracey Wolfe’], [’$20.39’], [‘red’], [‘09/15/17 ,\nIgnacio Parks’], [’$14.70’], [‘white&red’], [‘09/15/17 \n, Beatrice Newman’], [’$22.45’], [‘white&purple&red \n’], [‘09/15/17, Andre Norris’], [’$28.46’], [’\nred’], [‘09/15/17 , Albert Lewis’], [’$23.89’], [’\nblack&red’], [‘09/15/17, Javier Bailey’], [’\n$24.49’], [‘black&red’], [‘09/15/17 , Everett Lyons’], [’$1.81’], [‘black&red’], [‘09/15/17 , \nAbraham Maxwell’], [’$6.81’], [‘green’], [‘09/15/17 \n, Traci Craig’], [’$0.65’], [‘green&yellow’], [’\n09/15/17 , Jeffrey Jenkins’], [’$26.45’], [’\ngreen&yellow&blue’], [‘09/15/17, Merle Wilson \n’], [’$7.69’], [‘purple’], [‘09/15/17,Janis Franklin \n’], [’$8.74’], [‘purple&black’], [‘09/15/17 , \nLeonard Guerrero’], [’$1.86’], [‘yellow \n’], [‘09/15/17,Lana Sanchez’], [’$14.75’], [‘yellow’], [’\n09/15/17 ,Donna Ball’], [’$28.10’], [’\nyellow&blue’], [‘09/15/17 , Terrell Barber’], [’\n$9.91’], [‘green’], [‘09/15/17 ,Jody Flores’], [’\n$16.34’], [‘green’], [‘09/15/17, Daryl Herrera \n’], [’$27.57’], [‘white’], [‘09/15/17 , Miguel Mcguire’], [’$5.25’], [‘white&blue’], [‘09/15/17 , \nRogelio Gonzalez’], [’$9.51’], [‘white&black&blue \n’], [‘09/15/17 , Lora Hammond’], [’$20.56’], [’\ngreen’], [‘09/15/17,Owen Ward’], [’$21.64’], [’\ngreen&yellow’], [‘09/15/17,Malcolm Morales’], [’\n$24.99’], [‘green&yellow&black’], [‘09/15/17 , \nEric Mcdaniel’], [’$29.70’], [‘green’], [‘09/15/17 \n,Madeline Estrada’], [’$15.52’], [‘green’], [‘09/15/17 \n, Leticia Manning’], [’$15.70’], [‘green&purple’], [’\n09/15/17 , Mario Wallace’], [’$12.36’], [‘green’], [’\n09/15/17,Lewis Glover’], [’$13.66’], [’\ngreen&white’], [‘09/15/17, Gail Phelps’], [’$30.52 \n’], [‘green&white&blue’], [‘09/15/17 , Myrtle Morris \n’], [’$22.66’], [‘green&white&blue’], [‘09/15/17’]]

That’s not quite right. transactions_clean should look like this (this in only the first 3):

[['Edith Mcbride', '$1.21', 'white', '09/15/17'], ['Herbert Tran', '$7.29', 'white&blue', '09/15/17'], ['Paul Clarke', '$12.52', 'white&blue', '09/15/17'],

a list of lists where the nested lists are a single transaction

1 Like

Replaced the ‘\n’ and made 3 new lists for customers, sales, and thread sold. After appending the designated values to each list, I tried to print it to test if it worked.


daily_sales_replaced = daily_sales.replace(';,;', '+')
daily_transactions = daily_sales_replaced.split('+')

daily_transactions_split = []
for transaction in daily_transactions: 
  daily_transactions_split.append(transaction.split("+"))

transactions_clean = []
for transaction in daily_transactions_split:
  transaction_clean = []
  for data_point in transaction:
    transaction_clean.append(data_point.replace("\n", "").strip(" "))
    transactions_clean.append(transaction_clean)
     
 
customers = []
sales = []
thread_sold = []

for transaction in transactions_clean:
  customers.append(transaction[0])
  sales.append(transaction[1])
  thread_sold.append(transaction[2])

print(customers)
 
 

Result:
Traceback (most recent call last):
File “script.py”, line 132, in
sales.append(transaction[1])
IndexError: list index out of range

You’re adding more lines to your code without fixing the underlying issues so your errors are just propagating. Step back for a minute and look to fix the original problems first.

Double check the order of the instructions. You’re splitting your list on your replacement character ‘+’ earlier than suggested. Whilst you could do this it can make the next step harder if you’re trying to follow the given instructions. The original issue is also still there regarding repeating values and you’d need to address that too as per @codeneutrino’s guidance.

Try doing what @midlindner has suggested and actually check the contents of this list. Either remove or edit out your extra lines for now and make sure your initial output is correct. Without doing so you are unlikely to get the correct answers further down the line.

Attempt to complete the fixes given above and check the contents of that list either with print or something similar so you know you’ve got the first step completed correctly. Only then is it worthwhile to move on with the lesson.

3 Likes

Sorry i’m a total noob. I’d like to have the list look like that bit I don’t know how to do that while trying to iterate through each transaction to delete the “\n” and the " ". Does taking the loop a layer deeper automatically put brackets around each data point?

I took a few steps back and this is what I got.


daily_sales_replaced = daily_sales.replace(';,;', '+')
daily_transactions = daily_sales_replaced.split('+')

daily_transactions_split = []
for transaction in daily_transactions: 
  daily_transactions_split.append(transaction.split("+"))

transactions_clean = []
for transaction in daily_transactions_split:
  transaction_clean = []
  for data_point in transaction:
    transaction_clean.append(data_point.replace("\n", "").strip(" "))
    transactions_clean.append(transaction_clean)
     
print(transactions_clean)

Output:

[[‘Edith Mcbride’], [’$1.21’], [‘white’], [‘09/15/17 ,Herbert Tran’], [’$7.29’], [‘white&blue’], [‘09/15/17 ,Paul Clarke’], [’$12.52’], [‘white&blue’], [‘09/15/17 ,Lucille Caldwell’], [’$5.13’], [‘white’], [‘09/15/17,Eduardo George’], [’$20.39’], [‘white&yellow’], [‘09/15/17 , Danny Mclaughlin’], [’$30.82’], [‘purple’], [‘09/15/17 ,Stacy Vargas’], [’$1.85’], [‘purple&yellow’], [‘09/15/17, Shaun Brock’], [’$17.98’], [‘purple&yellow’], [‘09/15/17 , Erick Harper’], [’$17.41’], [‘blue’], [‘09/15/17, Michelle Howell’], [’$28.59’], [‘blue’], [‘09/15/17 , Carroll Boyd’], [’$14.51’], [‘purple&blue’], [‘09/15/17 , Teresa Carter’], [’$19.64’], [‘white’], [‘09/15/17 , Jacob Kennedy’], [’$11.40’], [‘white&red’], [‘09/15/17, Craig Chambers’], [’$8.79’], [‘white&blue&red’], [‘09/15/17 , Peggy Bell’], [’$8.65’], [‘blue’], [‘09/15/17, Kenneth Cunningham’], [’$10.53’], [‘green&blue’], [‘09/15/17 , Marvin Morgan’], [’$16.49’], [‘green&blue&red’], [‘09/15/17 ,Marjorie Russell’], [’$6.55’], [‘green&blue&red’], [‘09/15/17 ,Israel Cummings’], [’$11.86’], [‘black’], [‘09/15/17, June Doyle’], [’$22.29’], [‘black&yellow’], [‘09/15/17 , Jaime Buchanan’], [’$8.35’], [‘white&black&yellow’], [‘09/15/17, Rhonda Farmer’], [’$2.91’], [‘white&black&yellow’], [‘09/15/17, Darren Mckenzie’], [’$22.94’], [‘green’], [‘09/15/17,Rufus Malone’], [’$4.70’], [‘green&yellow’], [‘09/15/17 ,Hubert Miles’], [’$3.59’], [‘green&yellow&blue’], [‘09/15/17 , Joseph Bridges’], [’$5.66’], [‘green&yellow&purple&blue’], [‘09/15/17 , Sergio Murphy’], [’$17.51’], [‘black’], [‘09/15/17 , Audrey Ferguson’], [’$5.54’], [‘black&blue’], [‘09/15/17 ,Edna Williams’], [’$17.13’], [‘black&blue’], [‘09/15/17, Randy Fleming’], [’$21.13’], [‘black’], [‘09/15/17 ,Elisa Hart’], [’$0.35’], [‘black&purple’], [‘09/15/17 ,Ernesto Hunt’], [’$13.91’], [‘black&purple’], [‘09/15/17, Shannon Chavez’], [’$19.26’], [‘yellow’], [‘09/15/17 , Sammy Cain’], [’$5.45’], [‘yellow&red’], [‘09/15/17 , Steven Reeves’], [’$5.50’], [‘yellow’], [‘09/15/17, Ruben Jones’], [’$14.56’], [‘yellow&blue’], [‘09/15/17 , Essie Hansen’], [’$7.33’], [‘yellow&blue&red’], [‘09/15/17 , Rene Hardy’], [’$20.22’], [‘black’], [‘09/15/17 , Lucy Snyder’], [’$8.67’], [‘black&red’], [‘09/15/17 ,Dallas Obrien’], [’$8.31’], [‘black&red’], [‘09/15/17, Stacey Payne’], [’$15.70’], [‘white&black&red’], [‘09/15/17 , Tanya Cox’], [’$6.74’], [‘yellow’], [‘09/15/17 , Melody Moran’], [’$30.84’], [‘yellow&black’], [‘09/15/17 , Louise Becker’], [’$12.31’], [‘green&yellow&black’], [‘09/15/17 ,Ryan Webster’], [’$2.94’], [‘yellow’], [‘09/15/17 ,Justin Blake’], [’$22.46’], [‘white&yellow’], [‘09/15/17, Beverly Baldwin’], [’$6.60’], [‘white&yellow&black’], [‘09/15/17 , Dale Brady’], [’$6.27’], [‘yellow’], [‘09/15/17 ,Guadalupe Potter’], [’$21.12’], [‘yellow’], [‘09/15/17 , Desiree Butler’], [’$2.10’], [‘white’], [‘09/15/17 ,Sonja Barnett’], [’$14.22’], [‘white&black’], [‘09/15/17, Angelica Garza’], [’$11.60’], [‘white&black’], [‘09/15/17 , Jamie Welch’], [’$25.27’], [‘white&black&red’], [‘09/15/17 , Rex Hudson’], [’$8.26’], [‘purple’], [‘09/15/17 , Nadine Gibbs’], [’$30.80’], [‘purple&yellow’], [‘09/15/17 , Hannah Pratt’], [’$22.61’], [‘purple&yellow’], [‘09/15/17,Gayle Richards’], [’$22.19’], [‘green&purple&yellow’], [‘09/15/17 ,Stanley Holland’], [’$7.47’], [‘red’], [‘09/15/17 , Anna Dean’], [’$5.49’], [‘yellow&red’], [‘09/15/17 ,Terrance Saunders’], [’$23.70’], [‘green&yellow&red’], [‘09/15/17 , Brandi Zimmerman’], [’$26.66’], [‘red’], [‘09/15/17 ,Guadalupe Freeman’], [’$25.95’], [‘green&red’], [‘09/15/17 ,Irving Patterson’], [’$19.55’], [‘green&white&red’], [‘09/15/17 ,Karl Ross’], [’$15.68’], [‘white’], [‘09/15/17 , Brandy Cortez’], [’$23.57’], [‘white&red’], [‘09/15/17, Mamie Riley’], [’$29.32’], [‘purple’], [‘09/15/17 ,Mike Thornton’], [’$26.44’], [‘purple’], [‘09/15/17, Jamie Vaughn’], [’$17.24’], [‘green’], [‘09/15/17 , Noah Day’], [’$8.49’], [‘green’], [‘09/15/17 ,Josephine Keller’], [’$13.10’], [‘green’], [‘09/15/17 , Tracey Wolfe’], [’$20.39’], [‘red’], [‘09/15/17 ,Ignacio Parks’], [’$14.70’], [‘white&red’], [‘09/15/17 , Beatrice Newman’], [’$22.45’], [‘white&purple&red’], [‘09/15/17, Andre Norris’], [’$28.46’], [‘red’], [‘09/15/17 , Albert Lewis’], [’$23.89’], [‘black&red’], [‘09/15/17, Javier Bailey’], [’$24.49’], [‘black&red’], [‘09/15/17 , Everett Lyons’], [’$1.81’], [‘black&red’], [‘09/15/17 , Abraham Maxwell’], [’$6.81’], [‘green’], [‘09/15/17 , Traci Craig’], [’$0.65’], [‘green&yellow’], [‘09/15/17 , Jeffrey Jenkins’], [’$26.45’], [‘green&yellow&blue’], [‘09/15/17, Merle Wilson’], [’$7.69’], [‘purple’], [‘09/15/17,Janis Franklin’], [’$8.74’], [‘purple&black’], [‘09/15/17 , Leonard Guerrero’], [’$1.86’], [‘yellow’], [‘09/15/17,Lana Sanchez’], [’$14.75’], [‘yellow’], [‘09/15/17 ,Donna Ball’], [’$28.10’], [‘yellow&blue’], [‘09/15/17 , Terrell Barber’], [’$9.91’], [‘green’], [‘09/15/17 ,Jody Flores’], [’$16.34’], [‘green’], [‘09/15/17, Daryl Herrera’], [’$27.57’], [‘white’], [‘09/15/17 , Miguel Mcguire’], [’$5.25’], [‘white&blue’], [‘09/15/17 , Rogelio Gonzalez’], [’$9.51’], [‘white&black&blue’], [‘09/15/17 , Lora Hammond’], [’$20.56’], [‘green’], [‘09/15/17,Owen Ward’], [’$21.64’], [‘green&yellow’], [‘09/15/17,Malcolm Morales’], [’$24.99’], [‘green&yellow&black’], [‘09/15/17 , Eric Mcdaniel’], [’$29.70’], [‘green’], [‘09/15/17 ,Madeline Estrada’], [’$15.52’], [‘green’], [‘09/15/17 , Leticia Manning’], [’$15.70’], [‘green&purple’], [‘09/15/17 , Mario Wallace’], [’$12.36’], [‘green’], [‘09/15/17,Lewis Glover’], [’$13.66’], [‘green&white’], [‘09/15/17, Gail Phelps’], [’$30.52’], [‘green&white&blue’], [‘09/15/17 , Myrtle Morris’], [’$22.66’], [‘green&white&blue’], [‘09/15/17’]]

As @tgrtim, pointed out, you have a few things out of order. You’ve basically switched the order of step 3 and step 6. That’s how you end up with the date from the first transaction being combined in a list with the name for the next transaction which repeats through the entire transactions_clean list. Changing the order (splitting on commas as suggested in step 3) before splitting on your special character (step 6) will help immensely. Then you can look at why you get 4 of something that you only want 1 of. I would suggest commenting out most of the daily_sales string, and working with a much shorter version for debugging purposes:

daily_sales = \
"""Edith Mcbride   ;,;$1.21   ;,;   white ;,; 
09/15/17   ,Herbert Tran   ;,;   $7.29;,; 
white&blue;,;   09/15/17 ,Paul Clarke ;,;$12.52 
;,;   white&blue ;,; 09/15/17"""

The first three transactions are enough to be able to test your code, and the output will be much easier to read.