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()
final_sum=[]
for i in a:
data=i.split()
sum=0
for b in data[1:]:
sum=sum+int(b)
r=data[0]+str(sum)
print(r)
\ No newline at end of file
for she in data[1:]:
sum=sum+int(she)
r=data[0]+str(sum)+'\n'
final_sum.append(r)
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