Commit fae47105 by BellCodeEditor

save project

parent 5ec53ebb
Showing with 14 additions and 0 deletions
file=open(r'C:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')
a=file.readlines()
list=[]
for i in a:
b=i.split()
print(b)
sum=0
for i in b[1:]:
sum=sum+int(i)
f=b[0]+str(sum)
list.append(f)
print(list)
with open(r'C:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8') as file:
file.write(list)
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