Commit d9fc5935 by BellCodeEditor

save project

parent 4d94c6e1
Showing with 6 additions and 3 deletions
...@@ -2,5 +2,9 @@ with open(r"c:\Users\guo\Documents\lesson13-1\sales_list.txt","r",encoding="utf- ...@@ -2,5 +2,9 @@ with open(r"c:\Users\guo\Documents\lesson13-1\sales_list.txt","r",encoding="utf-
a=file.readlines() a=file.readlines()
#new_file=a.split() #new_file=a.split()
for i in a: for i in a:
new_file=i.split() data=i.split()
print(new_file) sum=0
\ No newline at end of file for j in data[1:]:
sum=sum+int(j)
result=data[0]+str(sum)
print(result)
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