Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.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 (已回答)not equals函数也针对允许的字符串_Python - Fatal编程技术网

Python (已回答)not equals函数也针对允许的字符串

Python (已回答)not equals函数也针对允许的字符串,python,Python,当试图在我的程序中创建限制时,即使我输入了正确的字符串,它仍然会说我不能这样做(但仍然允许我输入命令) 我尝试过使用else函数,但排除我所说的任何内容会使情况变得更糟 当我说: 输出为: 编辑:谢谢回答的人你的意思是说如果介绍不在('Price'、'Toppings'、'Base')?在if块中,你还需要退出程序。使用类似于sys.exit(1)的方法在这里创建Python元组。而是做介绍!='价格'或介绍!='浇头之类的 if Intro not in ('Price', 'Toppings

当试图在我的程序中创建限制时,即使我输入了正确的字符串,它仍然会说我不能这样做(但仍然允许我输入命令)

我尝试过使用else函数,但排除我所说的任何内容会使情况变得更糟

当我说: 输出为:
编辑:谢谢回答的人

你的意思是说如果介绍不在('Price'、'Toppings'、'Base')?在if块中,你还需要退出程序。使用类似于
sys.exit(1)
的方法在这里创建Python元组。而是做介绍!='价格'或介绍!='浇头之类的
if Intro not in ('Price', 'Toppings', 'Base'):
    print (" I do not think that is one of the available options")
Type Bases for bases- Bases
*I do not think that is one of the available options*
what base do you want- small
if Intro not in ('Price', 'Toppings', 'Base'):
    print (" I do not think that is one of the available options")