Commit 4fc434f5 by BellCodeEditor

save project

parent 87fe8f0f
Showing with 7 additions and 3 deletions
with open(r'c:\Users\MK011\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as abcd:
a=abcd.readlines()
new_sum=[]
for i in a:
q=i.split()
sum=0
for sales in q[1:]:
sum=sum+sales
print(sum)
\ No newline at end of file
sum=sum+int(sales)
result=q[0]+str(sum)+'\n'
new_sum.append(result)
with open(r'C:\Users\MK011\Desktop\bc.txt','a',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