Commit bd6b2ba6 by BellCodeEditor

auto save

parent e4fc5ace
Showing with 35 additions and 0 deletions
def price():
list=[]
while True:
n=input("请输入")
if n=='q':
break
else:
try:
n=int(n)
except:
print("请输入一个整数")
else:
list.append(n)
print("-"*30)
return list
#print(pri)
def money(list):
count=0
for i in list:
count=count+i
return count
pri=price()
print("你一共消费"+str(money(pri))+"元")
\ No newline at end of file
try:
age=int(input("请输入年龄"))
except:
print("请输入整数")
else:
if age<18:
print("不可以喝酒哦")
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