Commit 9afc1a0b by BellCodeEditor

save project

parent 5bd54fe1
Showing with 15 additions and 6 deletions
def food():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
unit = input("请输入:")
if unit == 'q':
break
else:
total.append(unit)
else:
try:
unit = int (unit)
except:
print("请再输入一个数字")
else:
total.append(unit)
print("-"*30)
print(total)
food()
\ No newline at end of file
......@@ -2,4 +2,7 @@ try:
age = int(input("你今年几岁了?"))
except:
print("要输入整数啊")
print("运行结束~")
\ No newline at end of file
print("运行结束~")
else:
if age < 18:
print("不可以喝酒哦~")
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