Commit 98f65c0c by BellCodeEditor

save project

parent 915f62c0
Showing with 7 additions and 2 deletions
sum=0 sum=0
with open(r'c:\Users\EDZ\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file: with open(r'c:\Users\EDZ\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines() a=file.readlines()
o=[]
for i in a: for i in a:
data=i.split() data=i.split()
for n in data[1:]: for n in data[1:]:
sum=sum+int(n) sum=sum+int(n)
c=data[0]+str(sum) c=data[0]+str(sum)
print(c) o.append(c)
\ No newline at end of file print(o)
with open(r'c:\Users\EDZ\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8') as file:
file.writelines(o)
\ 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