Commit 761bff47 by BellCodeEditor

save project

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