Commit 2fc4eb67 by BellCodeEditor

save project

parent f705f14d
Showing with 12 additions and 3 deletions
with open(r"C:\Users\lele\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8") as file:
a=file.read()
print(a)
\ No newline at end of file
a=file.readlines()
sum_list=[]
for i in a:
j=i.split()
sum=0
for num in j[1:]:
sum=sum+int(num)
x=j[0]+str(sum)
print(x)
sum_list.append(x+"\n")
with open(r"C:\Users\lele\Desktop\text0.txt","a",encoding="utf-8") as file0:
file0.writelines(sum_list)
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