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