Commit ad1f4c6d by BellCodeEditor

auto save

parent c9c9baf2
Showing with 5 additions and 3 deletions
with open("sales_list.txt",'r',encoding='utf-8') as file:
a=file.readlines()
final_sum=[]
for i in a:
i=i.split( )
sum=0
for sales in i[1:]:
sum=sum+int(sales)
result=i[0]+str(sum)+'\n'
print(result)
final_sumappend(result)
with open()
\ No newline at end of file
with open("new_salelist.txt",'a',encoding='utf-8') as file:
file.writelines(final_sum)
\ 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