The stuff in the parentheses is an expression that evaluates to a single value:
>>> "if" and ":" and " "
' '
>>> _ in "( )"
True
>>> ' ' in "( )"
True
>>> ("if" and ":" and " ") == ' '
True
and
is like the ordinary boolean AND
, but on steroids:
>>> 0 and 0
0
>>> 0 and 1
0
>>> 1 and 0
0
>>> 1 and 1
1
>>> 0 and 'hello'
0
>>> 'hello' and 0
0
>>> 'hello' and 'hello'
'hello' # WAIT. That's illegal!
So, and
returns the last truthy object in a chain of truthy objects (or the first non-truthy object it encounters). Notice that it returns an object, not strictly a boolean, like a binary AND would.