Find any value in list

(blenderaptor) #1

Hi !

a = [1,2,3]
a == [1,2,3]
a == [1,?,3]

What should i write instead of “?” to obtain True whatever its value?

(mavek) #2

python doesn’t really work that way. What you did is set a to a list and then test that a matches the same list.

The fastest way to solve this question is to break it up.

a[0] == 1 and a[2] == 3

but I suspect this is not the answer you were really looking for.

you could also use in

1 in a and 3 in a

but that isn’t postionally aware, if 1 and 3 swapped positions the first statment would be False but the second on would be True