Commit c2e82b70 by BellCodeEditor

save project

parent bf497174
Showing with 19 additions and 12 deletions
...@@ -2,16 +2,23 @@ def xkjnj(): ...@@ -2,16 +2,23 @@ def xkjnj():
total = [] total = []
while True: while True:
i=input("请输入:") i=input("请输入:")
if unit== 'q': if i== 'q':
break break
else: else:
total.append(unit)
print(total) try:
try: i=int(i)
xkjnj() except:
except: print('请输入整数')
print('请输入整数') else:
else: total.append(i)
total.append(i) print(total)
print(total) return total
return total y =xkjnj()
\ No newline at end of file def sum(c):
cun=0
for i in c:
cun=cun+i
print(cun)
return cun
sum(y)
\ 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