True and false with python script

hello!
i was wondering why the outcome of true and false scripted in python is not working…
so if x is greater than y, the out should be IN[1] or otherwise IN[2]. but, for the both true and false case, outcome is the same. they produce outcome as IN[1] even if its false.

Hi :slight_smile:
I think that the problem is that your IN[0] is a list, and not a bool.
Have you tried replacing condition = IN[0] by condition = IN[0][0] ?

Because your condition is a list
you walk taliste or flatten

it works! thank you! i tried to flatten but didnt work before. thanks again!

hello! can i ask one more question?
if i input several values, the outcome is not working properly. true and false the same outcome…

Hi again,
In that case, you would have to iterate on both yours conditions and your sublists.
I’m guessing you would want something like that :

condition = IN[0]
closedStrirrups = IN[1]
ushapeStirrups = IN[2]

output = []

for i in range(len(condition)):
    if(condition[i]) :
        output.append(closedStirrups[i])
    else:
        output.append(ushapeStirrups[i])

OUT = output

Is that what you were trying to achieve ?

1 Like

yesssss thank you so much!