Commit a59cc087 by BellCodeEditor

save project

parent 5ec53ebb
Showing with 21 additions and 0 deletions
a=["z\n",'z\n','m\n']
with open(r'\Users\Administrator\Desktop\hello.txt','a',encoding='utf_8')as file:
file.writelines(a)
with open(r'\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
# print(type(a[3:5]))
final_sum=[]
for i in a:
data=i.split()
# print(data)
sum=0
for sales in data[1:]:
sum=sum+int(sales)
result=data[0]+str(sum)+'\n'
final_sum.append(result)
#print(result)
with open(r'\Users\Administrator\Desktop\hello.txt','w',encoding='utf-8') as file:
file.writelines(final_sum)
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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