Commit 61e01590 by BellCodeEditor

auto save

parent 51d1ce77
Showing with 24 additions and 0 deletions
def price():
total = []
while True:
money = input("请输入你菜品的价格,输入q退出")
if money == 'q':
break
else:
try:
money = int(money)
except:
print('请输入正确的数字')
else:
total.append(money)
return total
def add(fee):
count = 0
for i in fee:
count += i
return count
a = price()
food_fee = add(a)
print('这餐总共消费金额%d' %food_fee)
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