Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.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_Logic - Fatal编程技术网

Python 下列条件相等吗

Python 下列条件相等吗,python,logic,Python,Logic,下列条件相等吗 if (array[i][j] == 1 and (i,j) not in APP) or (array[i][j] == 1 and (i,j) in APP and IterateAPP == 1) : #do stuff 如果#do stuff中的代码在两个位置都相同,则可以使用第一个代码段。但从逻辑上讲,它们是一样的 是的,第一个片段不包括打印“无所事事”部分,更简单的是,您可以考虑常见部分: if array[i][j] == 1

下列条件相等吗

      if (array[i][j] == 1 and (i,j) not in APP) or (array[i][j] == 1 and (i,j) in APP and IterateAPP == 1) :
            #do stuff

如果
#do stuff
中的代码在两个位置都相同,则可以使用第一个代码段。但从逻辑上讲,它们是一样的


是的,第一个片段不包括打印“无所事事”部分,更简单的是,您可以考虑常见部分:

if array[i][j] == 1 and (IterateAPP == 1 or (i,j) not in APP):
    # do stuff

这里有一些奇怪的变量名约定:)

是的,除了
打印“无所事事”
位之外
if array[i][j] == 1 and (IterateAPP == 1 or (i,j) not in APP):
    # do stuff