Commit c4eeaf52 by BellCodeEditor

auto save

parent 165a9904
Showing with 24 additions and 16 deletions
def new_input(): #sum=0
total = [] #while True:
while True: #i=input("请输入数字")
unit=input("请输入:") #if i=='q':
if unit=='q': #break
break #else:
else: #try:
try: #n=int(i)
un=int(unit) #except:
except: #print("请输入一个整数")
print("请重新输入!") #else:
else: #sum
total.append(un) with open('C:\\Users\\bellcode\\Desktop\\score.txt','r',encoding='utf-8')as fill:
print(total) a=fill.readlines()
new_input() c=''
\ No newline at end of file for i in a:
sum=0
b=i.split()
for j in b[1:]:
sum+=int(j)
c=c+b[0]+str(sum)+'\n'
with open('C:\\Users\\bellcode\\Desktop\\score.txt','w',encoding='utf-8')as fill:
a=fill.writelines(c)
\ 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