If condition in Python

Hi All,

I want to filter the walls by the thickness and name. So I have written this code in Python, i think the reason why its not working, is the fact that i combine two lists. Can somebody have a look and tell me what I am doing wrong and how it can be solved.

Tnx in advance,


the second loop should start from 4 space from the first loop , like this :

for x in range …
____for i in range …
________if etc …

Thank u for replying. I saw that also and fixed it. still it does not work. I think that naam[x].contains(“werk”);_ is the problemKnipsel

try changing and name[i].contains(“werk”): to:
and “werk” in name[i]:

1 Like

I don’t get an error, but it does not work. ides 8 should be true

I think it’s looping over too many times, try this instead:

OUT = [True if x>100 and x<200 and "werk" in i else False for x,i in zip(dikte,naam)]
1 Like

Still nothing. :frowning:


for x,i in zip(dikte,naam):
	if x>100 and x<200 and "werk" in i:

OUT = test

Can you show the preview of the Element.GetParameterValueByName node?

Tnx, this works great. Could you explain why this one worked and what i did wrong?
Still trying to learn Python

Both of them worked, if you didnt managed, then some other error must have been made.

in addition you could do it as a definition

def GetWerk(dikte, naam, t=[]):
    for x, i in zip(dikte, naam):
        if x > 100 and x < 200 and 'werk' in i:
    return t

OUT = GetWerk(IN[0], IN[1])

Home.dyn (3.9 KB)