Q:

Why does this if statement succeed?

The if statement below succeeds and the value of s is printed.  However if you remove the : and/or whitespace conditionals it then fails.  I am confused as to why it is succeeding in the first place.
    s="( )"
    if ("if" and ":" and " ") in s:
        print(s)

A:

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.

