i followed the guide to the letter but when I print transactions clean there is no whitespace. when I seperate it out into the individual variables it adds so much whitespace and wont let me strip it off again. I honestly dont understand what is going on. Other threads here dont seem to quite have the same issue. Please help.
I guess you could change
sales.append(transaction[1])
to
sales.append(transaction[1].strip())
to remove more whitespace there.
Also, please post your code by using the </> button and then pasting the code on lines between the ``` and ```
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 in transaction:
transaction_clean.append(data.replace("\n", "").strip(" "))
transactions_clean.append(transaction_clean)
print(transactions_clean)
customers = []
sales = []
thread_sold = []
for transacion in transactions_clean:
customers.append(transaction[0])
sales.append(transaction[1])
thread_sold.append(transaction[2])
#print(transactions_clean)
#print(customers)
#print(thread_sold)
print(sales)
total_sales = 0
for sale in sales:
total_sales += float(sale.strip("$"))
that worked but i dont understand why it added the whitespace. Do you understand why? Also thank you sooo much!