Commit 5b062bdd by BellCodeEditor

save project

parent 722ca927
Showing with 2 additions and 5 deletions
with open(r'c:\Users\eszcdr\Documents\lesson13-1\sales_list.txt','r',encoding='UTF_8')as file:
a=file.readlines()
file_sum=[]
for i in a:
date=i.split()
sum=0
#print(date[1:])
for sales in date[1:]:
sum=sum+int(sales)
b=date[0]+str(sum)+'\n'
file_sum.append(b)
b=date[0]+str(sum)
print(b)
with open(r'C:\Users\eszcdr\Desktop\new.txt','w',encoding='UTF-8')as file:
file.writelines(file_sum)
......
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