Commit 36f731f3 by BellCodeEditor

auto save

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