Commit ba23a623 by BellCodeEditor

save project

parent 220485da
Showing with 6 additions and 4 deletions
with open(r"c:\Users\Asus\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8") as file_1:
a = file_1.readlines()
final_list = []
for i in a:
date = i.split()
#print(date[0])
#print(date[1:])
sum1 = 0
final_list
for sales in date[1:]:
sum1 = sum1 + int(sales)
result = date[0] + str(sum1)
print(result)
\ No newline at end of file
final_list.append(result)
with open(r"c:\Users\Asus\Documents\lesson13-1\sales_list.txt","a",encoding="utf-8") as file_1:
file_1.writelines(final_list)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment