Commit e61fcfe8 by BellCodeEditor

save project

parent 40c45b00
Showing with 9 additions and 1 deletions
with open(r"c:\Users\lenovo\Documents\lesson13_2\sales_list.txt","r",encoding="utf-8") as q:
a = q.readlines()
fs = []
for i in a:
data = i.split()
print(data[1:])
sum = 0
for s in data[1:]:
sum += int(s)
b = data[0] + str(sum) + "\n"
fs.append(b)
with open(r"c:\Users\lenovo\Documents\lesson13_2\q_list.txt","w",encoding="utf-8") as g:
g.writelines(fs)
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