Guest User

Untitled

a guest
Nov 9th, 2018
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.36 KB | None | 0 0
  1. daily_sales = \
  2. """Edith Mcbride ;,;$1.21 ;,; white ;,;
  3. 09/15/17 ,Herbert Tran ;,; $7.29;,;
  4. white&blue;,; 09/15/17 ,Paul Clarke ;,;$12.52
  5. ;,; white&blue ;,; 09/15/17 ,Lucille Caldwell
  6. ;,; $5.13 ;,; white ;,; 09/15/17,
  7. Eduardo George ;,;$20.39;,; white&yellow
  8. ;,;09/15/17 , Danny Mclaughlin;,;$30.82;,;
  9. purple ;,;09/15/17 ,Stacy Vargas;,; $1.85 ;,;
  10. purple&yellow ;,;09/15/17, Shaun Brock;,;
  11. $17.98;,;purple&yellow ;,; 09/15/17 ,
  12. Erick Harper ;,;$17.41;,; blue ;,; 09/15/17,
  13. Michelle Howell ;,;$28.59;,; blue;,; 09/15/17 ,
  14. Carroll Boyd;,; $14.51;,; purple&blue ;,;
  15. 09/15/17 , Teresa Carter ;,; $19.64 ;,;
  16. white;,;09/15/17 , Jacob Kennedy ;,; $11.40
  17. ;,; white&red ;,; 09/15/17, Craig Chambers;,;
  18. $8.79 ;,; white&blue&red ;,;09/15/17 , Peggy Bell;,; $8.65 ;,;blue ;,; 09/15/17, Kenneth Cunningham ;,; $10.53;,; green&blue ;,;
  19. 09/15/17 , Marvin Morgan;,; $16.49;,;
  20. green&blue&red ;,; 09/15/17 ,Marjorie Russell
  21. ;,; $6.55 ;,; green&blue&red;,; 09/15/17 ,
  22. Israel Cummings;,; $11.86 ;,;black;,;
  23. 09/15/17, June Doyle ;,; $22.29 ;,;
  24. black&yellow ;,;09/15/17 , Jaime Buchanan ;,;
  25. $8.35;,; white&black&yellow ;,; 09/15/17,
  26. Rhonda Farmer;,;$2.91 ;,; white&black&yellow
  27. ;,;09/15/17, Darren Mckenzie ;,;$22.94;,;green
  28. ;,;09/15/17,Rufus Malone;,;$4.70 ;,; green&yellow
  29. ;,; 09/15/17 ,Hubert Miles;,; $3.59
  30. ;,;green&yellow&blue;,; 09/15/17 , Joseph Bridges ;,;$5.66 ;,; green&yellow&purple&blue
  31. ;,; 09/15/17 , Sergio Murphy ;,;$17.51 ;,;
  32. black ;,; 09/15/17 , Audrey Ferguson ;,;
  33. $5.54;,;black&blue ;,;09/15/17 ,Edna Williams ;,;
  34. $17.13;,; black&blue;,; 09/15/17, Randy Fleming;,; $21.13 ;,;black ;,;09/15/17 ,Elisa Hart;,; $0.35 ;,; black&purple;,; 09/15/17 ,
  35. Ernesto Hunt ;,; $13.91 ;,; black&purple ;,;
  36. 09/15/17, Shannon Chavez ;,;$19.26 ;,;
  37. yellow;,; 09/15/17 , Sammy Cain;,; $5.45;,;
  38. yellow&red ;,;09/15/17 , Steven Reeves ;,;$5.50
  39. ;,; yellow;,; 09/15/17, Ruben Jones ;,;
  40. $14.56 ;,; yellow&blue;,;09/15/17 , Essie Hansen;,; $7.33 ;,; yellow&blue&red
  41. ;,; 09/15/17 , Rene Hardy ;,; $20.22 ;,;
  42. black ;,; 09/15/17 , Lucy Snyder ;,; $8.67
  43. ;,;black&red ;,; 09/15/17 ,Dallas Obrien ;,;
  44. $8.31;,; black&red ;,; 09/15/17, Stacey Payne
  45. ;,; $15.70 ;,; white&black&red ;,;09/15/17
  46. , Tanya Cox ;,; $6.74 ;,;yellow ;,;
  47. 09/15/17 , Melody Moran ;,; $30.84
  48. ;,;yellow&black;,; 09/15/17 , Louise Becker ;,;
  49. $12.31 ;,; green&yellow&black;,; 09/15/17 ,
  50. Ryan Webster;,;$2.94 ;,; yellow ;,; 09/15/17
  51. ,Justin Blake ;,; $22.46 ;,;white&yellow ;,;
  52. 09/15/17, Beverly Baldwin ;,; $6.60;,;
  53. white&yellow&black ;,;09/15/17 , Dale Brady
  54. ;,; $6.27 ;,; yellow ;,;09/15/17 ,Guadalupe Potter ;,;$21.12 ;,; yellow;,; 09/15/17 ,
  55. Desiree Butler ;,;$2.10 ;,;white;,; 09/15/17
  56. ,Sonja Barnett ;,; $14.22 ;,;white&black;,;
  57. 09/15/17, Angelica Garza;,;$11.60;,;white&black
  58. ;,; 09/15/17 , Jamie Welch ;,; $25.27 ;,;
  59. white&black&red ;,;09/15/17 , Rex Hudson
  60. ;,;$8.26;,; purple;,; 09/15/17 , Nadine Gibbs
  61. ;,; $30.80 ;,; purple&yellow ;,; 09/15/17 ,
  62. Hannah Pratt;,; $22.61 ;,; purple&yellow
  63. ;,;09/15/17,Gayle Richards;,;$22.19 ;,;
  64. green&purple&yellow ;,;09/15/17 ,Stanley Holland
  65. ;,; $7.47 ;,; red ;,; 09/15/17 , Anna Dean;,;$5.49 ;,; yellow&red ;,; 09/15/17 ,
  66. Terrance Saunders ;,; $23.70 ;,;green&yellow&red
  67. ;,; 09/15/17 , Brandi Zimmerman ;,; $26.66 ;,;
  68. red ;,;09/15/17 ,Guadalupe Freeman ;,; $25.95;,;
  69. green&red ;,; 09/15/17 ,Irving Patterson
  70. ;,;$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,
  71. Mamie Riley ;,;$29.32;,; purple;,;09/15/17 ,Mike Thornton ;,; $26.44 ;,; purple ;,; 09/15/17,
  72. Jamie Vaughn ;,; $17.24;,;green ;,; 09/15/17 ,
  73. Noah Day ;,; $8.49 ;,;green ;,;09/15/17
  74. ,Josephine Keller ;,;$13.10 ;,;green;,; 09/15/17 , Tracey Wolfe;,;$20.39 ;,; red ;,; 09/15/17 ,
  75. Ignacio Parks;,;$14.70 ;,; white&red ;,;09/15/17
  76. , Beatrice Newman ;,;$22.45 ;,;white&purple&red
  77. ;,; 09/15/17, Andre Norris ;,; $28.46 ;,;
  78. red;,; 09/15/17 , Albert Lewis ;,; $23.89;,;
  79. black&red;,; 09/15/17, Javier Bailey ;,;
  80. $24.49 ;,; black&red ;,; 09/15/17 , Everett Lyons ;,;$1.81;,; black&red ;,; 09/15/17 ,
  81. Abraham Maxwell;,; $6.81 ;,;green;,; 09/15/17
  82. , Traci Craig ;,;$0.65;,; green&yellow;,;
  83. 09/15/17 , Jeffrey Jenkins ;,;$26.45;,;
  84. green&yellow&blue ;,; 09/15/17, Merle Wilson
  85. ;,; $7.69 ;,; purple;,; 09/15/17,Janis Franklin
  86. ;,;$8.74 ;,; purple&black ;,;09/15/17 ,
  87. Leonard Guerrero ;,; $1.86 ;,;yellow
  88. ;,;09/15/17,Lana Sanchez;,;$14.75 ;,; yellow;,;
  89. 09/15/17 ,Donna Ball ;,; $28.10 ;,;
  90. yellow&blue;,; 09/15/17 , Terrell Barber ;,;
  91. $9.91 ;,; green ;,;09/15/17 ,Jody Flores;,;
  92. $16.34 ;,; green ;,; 09/15/17, Daryl Herrera
  93. ;,;$27.57;,; white;,; 09/15/17 , Miguel Mcguire;,;$5.25;,; white&blue ;,; 09/15/17 ,
  94. Rogelio Gonzalez;,; $9.51;,; white&black&blue
  95. ;,; 09/15/17 , Lora Hammond ;,;$20.56 ;,;
  96. green;,; 09/15/17,Owen Ward;,; $21.64 ;,;
  97. green&yellow;,;09/15/17,Malcolm Morales ;,;
  98. $24.99 ;,; green&yellow&black;,; 09/15/17 ,
  99. Eric Mcdaniel ;,;$29.70;,; green ;,; 09/15/17
  100. ,Madeline Estrada;,; $15.52;,;green;,; 09/15/17
  101. , Leticia Manning;,;$15.70 ;,; green&purple;,;
  102. 09/15/17 , Mario Wallace ;,; $12.36 ;,;green ;,;
  103. 09/15/17,Lewis Glover;,; $13.66 ;,;
  104. green&white;,;09/15/17, Gail Phelps ;,;$30.52
  105. ;,; green&white&blue ;,; 09/15/17 , Myrtle Morris
  106. ;,; $22.66 ;,; green&white&blue;,;09/15/17"""
  107.  
  108. #------------------------------------------------
  109. # Start coding below!
  110.  
  111. daily_sales_replaced = daily_sales.replace(';,;', ':')
  112.  
  113. daily_transactions = daily_sales_replaced.split(",")
  114.  
  115. #print(daily_transactions)
  116.  
  117. daily_transactions_split = []
  118.  
  119. for daily_transaction in daily_transactions:
  120. daily_transactions_split.append(daily_transaction.split(':') )
  121.  
  122. #print(daily_transactions_split)
  123.  
  124. transactions_clean = []
  125.  
  126. for daily_transactions in daily_transactions_split:
  127. temp_list = []
  128. for daily_transaction in daily_transactions:
  129. temp_list.append(daily_transaction.replace("\n","").strip())
  130.  
  131. transactions_clean.append(temp_list)
  132.  
  133. #print(transactions_clean)
  134.  
  135. customers = []
  136. sales = []
  137. thread_sold = []
  138. transaction_date = []
  139.  
  140. for transactions in transactions_clean:
  141. customers.append(transactions[0])
  142. sales.append(transactions[1])
  143. thread_sold.append(transactions[2])
  144. transaction_date.append(transactions[3])
  145.  
  146. #print(customers)
  147. #print(sales)
  148. #print(thread_sold)
  149.  
  150. total_sales = 0
  151.  
  152. for sale_item in sales:
  153. total_sales += float(sale_item.strip('$'))
  154.  
  155. print("Total sales {}".format(total_sales))
  156.  
  157. #print(thread_sold)
  158.  
  159. thread_sold_split = []
  160.  
  161. for color in thread_sold:
  162. temp_list_color = []
  163. temp_list_color = color.split('&')
  164. for item in temp_list_color:
  165. thread_sold_split.append(item)
  166.  
  167. #print(thread_sold_split)
  168.  
  169. def color_count(color):
  170. color_freq = 0
  171. for thread in thread_sold_split:
  172. if thread == color:
  173. color_freq += 1
  174.  
  175. return color_freq
  176.  
  177. print(color_count('white'))
  178.  
  179. colors = []
  180.  
  181. for thread in thread_sold_split:
  182. if not thread in colors:
  183. colors.append(thread)
  184.  
  185. print(colors)
  186.  
  187. for color in colors:
  188. count_of_color = color_count(color)
  189. print("There were {} sold of {} today.".format(count_of_color, color))
Add Comment
Please, Sign In to add comment