Commit 61527b43 by BellCodeEditor

auto save

parent b6974dba
import func
a=func.input_num()
b=func.sum(a)
print(b)
\ No newline at end of file
def input_num():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
try:
if unit== 'q':
break
unit=int(unit)
except:
print("请输入数字")
else:
total.append(unit)
print(total)
#return total
return total
def sum(x):
ss=0
for i in range(len(x)):
ss=ss+x[i]
return ss
input_num()
#print(total)
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