Commit 36f731f3 by BellCodeEditor

auto save

parent 42c99e34
Showing with 10 additions and 27 deletions
def new_input():
list1 = []
while True:
nuit = input("请输入:")
if nuit == 'q':
break
while True:
try:
age = int(input("请输入你的年龄:"))
except:
print("请输入数字:")
else:
if age < 18 or age > 100:
print("不能喝酒哦!")
else:
try:
nuit = int(nuit)
except:
print("请输入数字,不是非数字:")
else:
list1.append(nuit)
finally:
print('=======================')
return list1
def sum(money):
count = 0
for i in money:
count += i
return count
if "__name__" == "__main__":
price = new_input()
total = sum(price)
print("菜价总数是:",total)
print("可以喝酒!")
\ 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