Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如果有输入,我可以';我找不到错误_Python_Python 3.x - Fatal编程技术网

Python 如果有输入,我可以';我找不到错误

Python 如果有输入,我可以';我找不到错误,python,python-3.x,Python,Python 3.x,这个代码怎么了?我可以输入我想要的任何东西,它会打印“Nice” 这是我的第一个代码,所以可能是个小错误。 谢谢你的回答。“苹果”或“苹果”总是正确的,或者更准确地说“苹果”被认为是正确的,任何或正确的都是正确的。 print ("Hi and welcome to our online shop.\n\nWhich fruit would you like to buy? Apple, Banana or Strawberry?") x = input() if x is "Apple"

这个代码怎么了?我可以输入我想要的任何东西,它会打印“Nice”

这是我的第一个代码,所以可能是个小错误。 谢谢你的回答。

“苹果”或“苹果”
总是
正确的
,或者更准确地说
“苹果”
被认为是
正确的
,任何
正确的都是
正确的
print ("Hi and welcome to our online shop.\n\nWhich fruit would you like to buy? Apple, Banana or Strawberry?")

x = input()

if x is "Apple" or "apple":
    print ("Nice.")

elif x is "Banana" or "banana":
    print ("Great.")

elif x is "Strawberry" or "strawberry":
    print ("Cool.")

else:
    print ("Please enter a avaliable product")