Commit 170ff241 by BellCodeEditor

save project

parent d1536a55
Showing with 14 additions and 0 deletions
result = ""
with open(r'c:\Users\1\Desktop\book.txt','r',encoding='utf-8') as file1:
a=file1.readlines()
for i in a:
b=i.split()
sum=0
for j in b[1:]:
sum+=int(j)
result+= b[0]+str(sum)+"\n"
print(result)
with open(r'c:\Users\1\Desktop\book.txt','w',encoding='utf-8') as file1:
file1.write(result)
\ 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