Grasshopper Python

hello,

i would like to make these queries of the lists in x and y and as a result have a list again after the query if then. can someone help me please?

best regards, michael


Hi,

how about something like this?


GH Python.gh (7.9 KB)

I expect that this is a type problem. Those are string values coming into the Grasshopper component. To run the == on numbers them they need to be Integers or Floats. Right clicking on the inputs x and y and setting type hint to Float should solve the problem.

print(type(x)) can be watched on the out port.

hi @scottd ,
thanks for your response. I tried that with type hint but that’s not the problem.

use type hint int, then press play in the code editor

PS:sometimes the python compiler doesn’t work properly. the work around to that is to create a new battery, paste the code, press play

Send the def here if you want I can take a look. Internalizing the lists in a component will help.

Does this one work for you?

py3-int.gh (12.4 KB)

Hi @scottd @adel.albloushi @fcegnam ,
thanks for your help. now it works!
Kind regards