Commit cf223e64 by BellCodeEditor

save project

parent 6b049616
Showing with 5 additions and 2 deletions
with open(r"c:\Users\XMBC\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8") as abc: with open(r"c:\Users\XMBC\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8") as abc:
a=abc.readlines() a=abc.readlines()
#print(a) #print(a)
e=[]
for i in a: for i in a:
b=i.split() b=i.split()
#print(b[1:]) #print(b[1:])
sum=0 sum=0
for j in b[1:]: for j in b[1:]:
sum=sum+int(j) sum=sum+int(j)
c=b[0]+str(sum) c=b[0]+str(sum)+"\n"
print(c) e.append(c)
with open(r"c:\Users\XMBC\Desktop\abc.txt","w",encoding="utf-8")as ab:
ab.writelines(e)
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