Link: https://www.codecademy.com/courses/learn-python-3/projects/thread-shed
So I was having a ton of issues figuring it out, had one way that was more hard coded and not as organized, using ranges to go through the index’s because I was having issues with the for loops and the lists at different times.
ANYWAY…
I opened the stuck video and tried to do it how he did it, didn’t work, so I scrapped the whole thing and literally copied down word for word what he did and am still getting a huge propblem.
So, everything is going fine up until this part in the code: (PS THE INDENTS IN THE FORUM ARENT WORKING FOR THIS PART IDK WHY BUT I DO HAVE THEM INDENTED)
Edit: Issue resolved I just read the starter forum for proper code format, my apologies.
transactions_clean = []
for transactions in daily_transactions_split:
transaction_clean = []
for data_points in transactions:
transaction_clean.append(data_points.replace("\n", "").strip())
transactions_clean.append(transaction_clean)
The issue is at the bottom for the:
transactions_clean.append(transaction_clean)
line, it has each item in the list printed out 4 times. When I remove an indent to the bottom one, then it prints them out one at a time, but now the function afterwards when you append the customer/sales/etc lists has issues.
Why is it doing this? Why is it when I watch the video to “get unstuck” and do line for line, his comes out just fine? 5:05 IN YOUTUBE VIDEO.
Can anyone tell me what I am doing wrong?
Here is my full code so that you people who always ask for more information don’t have to.
# Start coding below!
## Starting by splitting the code.
daily_sales_replaced = daily_sales.replace(";,;", ";")
#print(daily_sales_replaced)
daily_transactions = daily_sales_replaced.split(",")
#print(daily_transactions)
daily_transactions_split = []
for transactions in daily_transactions:
daily_transactions_split.append(transactions.split(";"))
#print(daily_transactions_split)
transactions_clean = []
for transactions in daily_transactions_split:
transaction_clean = []
for data_points in transactions:
transaction_clean.append(data_points.replace("\n", "").strip())
transactions_clean.append(transaction_clean)
#print(transaction_clean)
print(transactions_clean)
customers = []
sales = []
thread_sold = []