Commit b300052d by BellCodeEditor

save project

parent f48e76f6
Showing with 8 additions and 2 deletions
...@@ -17,12 +17,18 @@ ...@@ -17,12 +17,18 @@
# print(a) # print(a)
with open(r'c:\Users\EDY\Documents\lesson13_2\sales_list.txt','r',encoding='utf-8') as filel: with open(r'c:\Users\EDY\Documents\lesson13_2\sales_list.txt','r',encoding='utf-8') as filel:
b=filel.readlines() b=filel.readlines()
e=[]
for i in b: for i in b:
s=i.split() s=i.split()
sum=0 sum=0
for m in s[1:]: for m in s[1:]:
sum=sum+int(m) sum=sum+int(m)
n=s[0]+str(sum) n=s[0]+str(sum)+"/n"
print(n) e.append(n)
with open(r'C:\Users\EDY\Desktop\test.txt','a',encoding='utf-8') as filel:
filel.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