【发布时间】:2022-06-19 00:25:33
【问题描述】:
这是我的代码:
print("What is your Name")
user_name = input("User Name: ")
print(f"Hello {user_name} please choose a dish and a drink from this menu : \n Fish \t Eggs \n Water \t Juice")
food = input("Please input your desired dish: ")
drink = input("Please input your desired drink: ")
if food != "Fish" or "Eggs":
print("Please input a correct dish or drink")
else:
print(f"{user_name} your desired drink is {drink} and your desired dish is {food}")
主要问题是最后一部分。我想说“如果食物不等于鱼或鸡蛋,则打印错误消息,但如果它打印成功消息”。但是,如果您复制代码并在最后跟随它,它总是会打印错误消息。
【问题讨论】:
标签: python