Python test for more then 2 inputs

Hi, does anyone know how I would get this to output the correct list depending on the number. The list is from 0 to 3. Thanks for any help

Sounds like you need to turn it into an IF statement then loop for the other possible results. I’m not entirely sure how you would do this with design script but you could use python for this.

yeah I was thinking it might need to be a python input script. Not quite sure what im doing. Brains working on bits and pieces I’ve either made up or seen

test = IN[0]
0 = IN[1]
1 = IN[2]
2 = IN[3]
3 = IN[4]

If test = 0:
 OUT = IN[1]
else if test = 1:
 OUT = IN[2]
else if test = 2:
 OUT = IN[3]
else if test = 3:
 OUT = IN[4]

The test will only return ‘true’ or ‘false’. If you want to pull another index beyond 0 or 1, you’ll need to nest multiple tests, as you did in that Python you posted. The Design Script version thereof would be something like this:

tests = [t1,t2,t3,t4,t5];
vals = [r1,r2,r3,r4,r5];
indx = t1? 0 : t2? 1 : t3 ? 2 : t4 ? 3 : 4;
vals[indx];
1 Like