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 < = 100):”它特别强调在冒号“:”,是不是如何使if在Python中的语句?我应该继续在while循环之前定义吗?Python While循环(检查行6)
你'而情况也是错误的。 (“y”,“Y”):'。 – chepner