Commit a27967c8 by BellCodeEditor

save project

parent 48d2b495
Showing with 14 additions and 2 deletions
...@@ -3,7 +3,7 @@ def er(): ...@@ -3,7 +3,7 @@ def er():
total = [] total = []
while True: while True:
#提示用户输入,用unit变量接受输入的值 #提示用户输入,用unit变量接受输入的值
unit=int(input('请输入‘按q退出')) unit=input('请输入‘按q退出')
if unit=='q': if unit=='q':
break break
else: else:
...@@ -16,5 +16,17 @@ def er(): ...@@ -16,5 +16,17 @@ def er():
print(total) print(total)
return total return total
er() price=er()
print("==========================================")
print(price)
print('我下面开始计算菜单的总价')
'''
思路:
遍历得到列表中的每个值,然后让他们相加
'''
#定义一个变量储存总价
sum=0
for i in price:
sum+=i
print('菜单的总价格为:'+sum)
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