Python Question about basic syntax

hello guys,

I am new to Python and before use JAVA.
a silly question as showed in pic and gh file.
what is the right syntax to finish this small code?

thanks so much!

check (8.1 KB)

if i == j: x.remove(i)

(colon, not comma)


Hi Mitch,

thanks for the replay.
However inside that script, ‘x’ is ‘unsized object’, which, i guess, x is undefined, and how to define x, or
how to passing input data to x?


Well, that depends on how you have your inputs set up (right click on the input for type hint and item/list/tree access). If you set the x,y inputs to list access and make the other correction I mentioned above, it should work.

However, in this case, I would just use the native “Set Difference” component to achieve the same result…


Yes the set difference could do.
just curious if python could do as java.
But I tried in that code didn`t work.
is it possible you could help me to fix that code?

Thank you so much

I just did what I described above, fixed the one line of code inside the editor and set the two inputs x and y to list item access…

Attached is the fixed .gh, which includes a second definition using python’s native set methods.

check (11.2 KB)

HTH, --Mitch

Thank you!