Commit 86a20100 by BellCodeEditor

save project

parent 05e7d622
Showing with 46 additions and 0 deletions
def new_input():
total = []
while True:
unit= input("请输入:")
try:
if unit== 'q':
break
unit=int(unit)
except ValueError:
print("请输入数字")
continue
else:
total.append(unit)
return total
def sum(a):
price=0
for i in a:
price+=i
print(price)
sum(new_input())
\ No newline at end of file
def new_input():
point=[]
while True:
swimmer=input("请输入")
if swimmer=="q":
break
try:
swimmer=int(swimmer)
except ValueError:
print("请输入数字")
else:
point.append(swimmer)
return point
def sum(a):
point2=0
for i in a:
point2+=i
print("这位选手的总分数为:"+str(point2))
sum(new_input())
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