Commit 473dad4f by BellCodeEditor

save project

parent 578e41ee
total = []
while True:
def newinput():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
try:
n=int(unit)
except:
print("请输入整数")
else:
total.append(unit)
print(total)
\ No newline at end of file
total.append(n)
print(total)
return total
def sum(A):
B=0
for i in A:
B=B+i
return B
import func
N=func.newinput()
H=func.sum(N)
print("总分数是:"+str(H))
\ 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