Commit 02acf5ce by BellCodeEditor

save project

parent 61b13441
Showing with 11 additions and 6 deletions
def eat(): def eat():
total = [] total = []
while True: while True:
try: unit = input("请输入(按q退出):")
unit = int (input("请输入:"))
if unit== 'q': if unit== 'q':
break break
else: else:
try:
unit = int(unit)
except:
print("请输入整数")
else:
total.append(unit) total.append(unit)
finally: finally:
print("-"*30)
print(total) return total
eat() z = eat()
\ No newline at end of file print(z)
\ 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