这应该是商店中系统的代码,如果有人想买别的东西,它会一次又一次地循环。请帮忙。
menu=["apple","water","juice"]
apple=50
water=80
juice=100
money=int(input("How much money in pennies do you have?"))
if money>=100:
print("We have the following items you can buy: apple, water, juice")
elif money>=80 and money<=100:
print("We have the following items you can buy: apple, water")
elif money>=50 and money<=80:
print("We have the following item you can buy: apple")
else:
print("Sorry, you can't buy anything.")
buy=input("What do you want to buy?")
if buy=="apple":
print("You have",money-50)
elif buy=="water":
print("You have",money-80)
else:
print("You have",money-100)
other=(input("Do you want to buy anything else?"))
if other=="yes":
while x=0:
print(x)
continue
elif other=="no":
x+1
else:
print("Error")
最后一部分不起作用 - 有人可以修复它吗?这是 Python 3-谢谢。
天涯尽头无女友
相关分类