Commit 59d91551 by BellCodeEditor

save project

parent 8f2a1c5c
Showing with 5 additions and 4 deletions
with open (r"c:\Users\Windows 10\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8") as file:
list=file.readlines()
wl=[]
for i in list:
data = i.split()
sum = 0
for j in data[1:]:
sum+=int(j)
result = data[0]+str(sum)
print(result)
result = data[0]+str(sum)+"\n"
wl.append(result)
with open (r"c:\Users\Windows 10\Documents\lesson13-1\sales_list.txt","a",encoding="utf-8") as file:
file.writelines(wl)
......
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