Commit d0b4762d by BellCodeEditor

save project

parent d1536a55
Showing with 28 additions and 0 deletions
# with open(r'C:\Users\16064\Desktop\sales_list.txt','r',encoding='utf-8') as file:
# a=file.readlines()
# #print(a)
# for i in a:
# #print(i)
# new_i=i.split()
# #print(new_i)
# print(new_i[0])
# print(new_i[1:])
with open(r'C:\Users\16064\Desktop\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
#print(a)
c=[ ]
for i in a:
#print(i)
new_i=i.split()
#print(new_i)
#print(new_i[0])
#print(new_i[1:])
sum=0
for sales in new_i[1:]:
sum=sum+int(sales)
b=new_i[0]+str(sum)+'\n'
c.append(b)
with open(r'C:\Users\16064\Desktop\sales_list.txt','a',encoding='utf-8') as file:
file.writelines(c)
\ 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