Commit 6527b33d by BellCodeEditor

save project

parent 59c64a2e
Showing with 6 additions and 7 deletions
with open(r'c:\Users\EDZ\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a = file.readlines()
f=[]
for i in a:
b = i.split()
# print(b[1:])
sum=0
for c in b[1:]:
sum=sum+int(c)
print(b[0]+str(sum))
# FileExistsError
g=b[0]+str(sum)+'\n'
f.append(g)
with open(r'C:\Users\EDZ\Desktop\aip.txt','a',encoding='utf-8') as file:
e=file.writelines(f)
\ 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