Compare booleans out of 2 lists

I would definitely commend @Nick_Boyts suggestion in the first instance, paired with Group by Key. But to answer your secondary question, if you wanted it in Python something like this? You get the elements outputted into the four groups, so you just select the index of the group(s) you are interested in

a = IN[0][0]
b = IN[0][1]
elems = IN[1]

output = [,,,]

for i,j,el in zip(a,b,elems):
if i == True and j == True:
n = 0
elif i == True and j == False:
n = 1
elif i == False and j == True:
n = 2
elif i == False and j == False:
n = 3
output[n].append(el)

Assign your output to the OUT variable.
OUT = output

2 Likes

Just to finish off my train of thought…

Here’s an option (which I think) lets you input whatever ‘tests’ you like and get the objects back…

Incidently, it’s a bit odd that the Dynamo nodes don’t treat lists as an object, when Python is quite happy to…

Hopefully it’s of interest :slight_smile:

Mark

elemDataList = IN[0]
testDataList = IN[1]
elemList = IN[2]

output = []

i = 0
while i < len(testDataList):
	test = testDataList[i]
	data = []
	for elemData, elem in zip(elemDataList, elemList):			
		if test == elemData:	
			data.append(elem)
	output.append(data)
	i += 1

OUT = output

2 Likes

Nice one! thanks a lot @Mark.Ackerley

1 Like