Commit 8807a180 by BellCodeEditor

save project

parent 0ed26cbe
Showing with 6 additions and 1 deletions
with open(r"c:\Users\EDZ\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8")as file1: with open(r"c:\Users\EDZ\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8")as file1:
a=file1.readlines() a=file1.readlines()
b=[]
#print(a) #print(a)
for i in a: for i in a:
i=i.split() i=i.split()
...@@ -8,5 +9,8 @@ for i in a: ...@@ -8,5 +9,8 @@ for i in a:
sum=0 sum=0
for sales in i[1:]: for sales in i[1:]:
sum=sum+int(sales) sum=sum+int(sales)
a=i[0]+str(sum) a=i[0]+str(sum)+'\n'
b.append(a)
print(a) print(a)
with open(r"c:\Users\EDZ\Documents\lesson13-1\sales_list.txt","a",encoding="utf-8")as file1:
\ 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