Commit 013ac6ce by BellCodeEditor

save project

parent 272df39b
Showing with 7 additions and 3 deletions
with open(r'c:\Users\XMBC\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as k: with open(r'c:\Users\XMBC\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as k:
a=k.readlines() a=k.readlines()
new_data=[]
for i in a: for i in a:
data=i.split() data=i.split()
###print(data[1:])
sum=0 sum=0
for c in data[1:]: for c in data[1:]:
sum+=int(c) sum+=int(c)
print(data[0]+str(sum)) b=data[0]+str(sum)+'\n'
\ No newline at end of file new_data.append(b)
with open(r'c:\Users\XMBC\Desktop\h.txt','w',encoding='utf-8') as k:
k.writelines(new_data)
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