Commit 197f3512 by BellCodeEditor

auto save

parent 578e41ee
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
try:
unit = int(unit)
except :
print('请输入整数')
else:
total.append(unit)
finally:
print('-'*20)
return total
#求和函数
def sum(money):
count = 0
for i in money:
count += i #count = count + i
return count
# total = new_input()
# a = sum(total)
# print('菜品的总价是:',a)
import demo
data = demo.new_input()
score = demo.sum(data)
print('选手的总分是',score)
\ 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