Commit 45b3d7c8 by BellCodeEditor

save project

parent 4e1ad0df
Showing with 10 additions and 3 deletions
with open(r'c:\Users\EDZ\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')as file:
a=file.readlines()
s=[]
for i in a:
d=i.split()
sum=0
for sales in d[1:]:
sum=sum+int(sales)
r=d[0]+str(sum)
print(r)
r=d[0]+str(sum)+'\n'
s.append(r)
with open(r'c:\Users\EDZ\Documents\lesson13-1\siles_list.txt','w',encoding='utf-8') as file:
file.writelines(s)
\ 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