Commit 0209aa6e by BellCodeEditor

save project

parent 7bd39b0c
Showing with 13 additions and 10 deletions
...@@ -2,14 +2,17 @@ def func(): ...@@ -2,14 +2,17 @@ def func():
total = [] total = []
while True: while True:
unit= input("请输入:") unit= input("请输入:")
try: if unit== 'q':
unit1= int(unit)
except
if unit== 'q':
print("结束") print("结束")
break break
print("要输入整数") try:
continue unit1= int(unit)
else: except:
total.append(unit) print("要输入整数")
print(total) continue
\ No newline at end of file else:
total.append(unit)
return total
r = func()
print(r)
\ 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