Commit 36f731f3 by BellCodeEditor

auto save

parent 42c99e34
Showing with 8 additions and 25 deletions
def new_input(): while True:
list1 = []
while True:
nuit = input("请输入:")
if nuit == 'q':
break
else:
try: try:
nuit = int(nuit) age = int(input("请输入你的年龄:"))
except: except:
print("请输入数字,不是非数字:") print("请输入数字:")
else:
if age < 18 or age > 100:
print("不能喝酒哦!")
else: else:
list1.append(nuit) print("可以喝酒!")
finally: \ No newline at end of file
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)
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