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