Commit fbc12c27 by BellCodeEditor

save project

parent 62c58381
Showing with 15 additions and 2 deletions
......@@ -7,4 +7,17 @@ with open(r'c:\Users\admin\Desktop\scores.txt','w',encoding='utf-8') as file:
file.write(a)
file.write(b)
file.write(c)
file.write(d)
\ No newline at end of file
file.write(d)
with open(r'c:\Users\admin\Desktop\scores.txt','r',encoding='utf-8') as file:
data=file.readlines()
new_list=[]
for i in data:
sum=0
a=i.split()
for score in a[1:]:
sum+=int(score)
str1=a[0]+str(sum)+'\n'
new_list.append(str1)
print(new_list)
with open(r'c:\Users\admin\Desktop\scores.txt','a',encoding='utf-8') as file:
file.writelines(new_list)
\ 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