Commit 40fc997d by BellCodeEditor

save project

parent eb7e1eae
Showing with 10 additions and 7 deletions
with open(r'c:\Users\DELL\Documents\lesson13-1\txt','r',encoding='utf-8') as file: with open(r'C:\Users\DELL\Desktop\txt','r',encoding='utf-8') as file:
a=file.readlines() a=file.readlines()
final_sum=[]
for i in a: for i in a:
data=i.split() data=i.split()
sum=0 sum=0
for b in data[1:]: for she in data[1:]:
sum=sum+int(b) sum=sum+int(she)
r=data[0]+str(sum) r=data[0]+str(sum)+'\n'
print(r) final_sum.append(r)
\ No newline at end of file with open(r'C:\Users\DELL\Desktop\txt','a',encoding='utf-8') as file:
file.writelines(final_sum)
\ 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