Commit 9f0126b0 by BellCodeEditor

save project

parent a51a07af
def new_input (): def new_input():
total = [] total = []
while True: while True:
unit= input("请输入:") unit = input("请输入:")
if unit== 'q': if unit == 'q':
return(total) return (total)
break break
else: else:
try : try:
int(unit) int(unit)
except : except:
print("输入整数") print("输入整数")
else: else:
print("-"*30) print("-" * 30)
total.append(unit) total.append(int(unit))
print(total)
new_input()
# print(total)
# return total
#ew_input()
def 统计分数(arr):
total = 0
for i in range(len(arr)):
total += arr[i]
return (total)
\ No newline at end of file
import func
date = func.new_input()
score = func.统计分数(date)
print("这位选手的总分是", score)
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