【发布时间】:2016-03-07 11:49:45
【问题描述】:
def purchace():
total=0
while keepgoing == ("y" or "Y"):
item= float(input("Enter price of the item")
if (item<=100):
dis=(.15*item)
price=(item-dis)
else:
dis=(.25*item)
price=(item-dis)
total+= item
keepgoing = raw_input("Do you want to add more items? (y/n)")
print("Your total is ",total)
print("Thank you")
def main():
purchase()
main()
第 6 行“if (item
【问题讨论】:
-
您的
while条件也是错误的。while keepgoing in ("y", "Y"):.
标签: python while-loop boolean do-while