Commit 7afd9fc7 by BellCodeEditor

save project

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