Commit b31331f4 by BellCodeEditor

save project

parent 03c4037e
Showing with 6 additions and 3 deletions
with open(r"c:\Users\Windows 10\Documents\lesson13-1\sales_list.txt","r",encoding='utf-8') as file:
list=file.readlines()
jg = []
for i in list:
data = i.split()
sum = 0
for j in data[1:]:
sum+=int(j)
result = data[0]+str(sum)
print(result)
\ No newline at end of file
result = data[0]+str(sum)+"\n"
jg.append(result)
with open(r"c:\Users\Windows 10\Documents\lesson13-1\sales_list.txt","a",encoding='utf-8') as file:
file.writelines(jg)
\ 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