Commit a27967c8 by BellCodeEditor

save project

parent 48d2b495
Showing with 15 additions and 4 deletions
......@@ -3,7 +3,7 @@ def er():
total = []
while True:
#提示用户输入,用unit变量接受输入的值
unit=int(input('请输入‘按q退出'))
unit=input('请输入‘按q退出')
if unit=='q':
break
else:
......@@ -16,5 +16,17 @@ def er():
print(total)
return total
er()
\ No newline at end of file
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