【发布时间】:2016-01-22 10:40:03
【问题描述】:
这是我的代码:
item=0
while True:
menu=input (""" ----- Heart Attacks On A Bun ----------
1. The Big MOO Combo . . . . 5.99
2. Big MOO . . . . . . . . . 3.99
3. Spring Surprise . . . . . 1.99
4. Fries . . . . . . . . . . 1.29
5. Pop . . . . . . . . . . . 1.19
6. Exit
________________________________________
What would you like? one for combo, two for Big MOO etc.
""")
if item=="one":
item+=5.99
elif item=="two":
item+=3.99
elif item=="three":
item+=1.99
elif item=="Four":
item+=1.29
elif item=="Five":
item+=1.19
elif item=="six":
break
print ("Your total is", item,"dollars")
为什么当我输入 6 时,我的循环没有退出并打印总数?我也是初学者,这是高中课程
【问题讨论】:
标签: python loops python-3.x while-loop