Commit 9cd1d3a8 by BellCodeEditor

save project

parent 5acc0b0e
Showing with 0 additions and 5 deletions
...@@ -2,16 +2,12 @@ with open(r'c:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','r',encoding='u ...@@ -2,16 +2,12 @@ with open(r'c:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','r',encoding='u
a=file.readlines() a=file.readlines()
c=0 c=0
d=0 d=0
yyy=[]
for i in a: for i in a:
data=i.split() data=i.split()
b=data[1:] b=data[1:]
for ggg in b: for ggg in b:
c=c + int(ggg) c=c + int(ggg)
d=d + int(ggg) d=d + int(ggg)
ppp=data[0]+str(d)+' \n'
print(data[0],d) print(data[0],d)
with open(r'c:\Users\Lenovo\Documents\lesson13-5\sales_list.txt','a',encoding='utf-8') as file:
file.writelines(ppp)
d=0 d=0
print(c) print(c)
\ 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