Commit 377b986f by BellCodeEditor

auto save

parent 2136af46
Showing with 13 additions and 3 deletions
with open(r'c:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file: with open(r'c:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a = file.readlines() a = file.readlines()
for i in a: final_list = []
print(i) for i in a:
\ No newline at end of file sum = 0
list = i.split()
for x in list[1:]:
sum += int(x)
result = list[0] + ':' + str(sum) + '\n'
final_list.append(result)
# with open(r'c:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8') as file:
# file.writelines(final_list)
print(final_list)
\ 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