Commit 9afc1a0b by BellCodeEditor

save project

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