Commit 3a3da63c by BellCodeEditor

auto save

parent 4e6b587a
Showing with 13 additions and 0 deletions
with open(r'c:\Users\mk\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as abc:
a=abc.readlines()
new_sum=[]
for i in a:
b=i.split()
sum=0
for sales in b[1:]:
sum=sum+int(sales)
result=b[0]+str(sum)+'\n'
new_sum.append(result)
with open(r'C:\Users\mk\Desktop\a.txt','w',encoding='utf-8') as p:
p.writelines(new_sum)
\ 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