Commit debe8bbe by BellCodeEditor

save project

parent 034f8d59
Showing with 22 additions and 3 deletions
students.pop(2)
students.remove("八戒")
insert(-2,"诺依")
append("诺依")
ijo=["诺依"]
students.extend(ijo)
\ No newline at end of file
file=open(r'c:\Users\cc\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') file=open(r'c:\Users\cc\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')
a=file.readlines() a=file.readlines()
print(a) #print(a)
final_sum=[]
for i in a: for i in a:
data=i.split(" ") data=i.split(" ")
print(data[1:]) #print(data[1:])
new_data=data[1:] new_data=data[1:]
toatl=0 toatl=0
for h in new_data: for h in new_data:
toatl=toatl+int(h) toatl=toatl+int(h)
print(toatl) result=data[0]+str(toatl)+'\n'
final_sum.append(result)
file=open(r'c:\Users\cc\Documents\lesson13-1\sales_list.txt','w',encoding='utf-8')
file.writelines(final_sum)
file.close()
fil=eopen(r'c:\Users\cc\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')
k=file.read()
print(k)
file.close()
\ 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