Start with under what conditions the else
branch would not match. It'd be one of a
, or b
, or c and d
, so you would need to use or
and not
here to express when the else
branch of your original code would be picked:
if not (a or b or (c and d)):
e()
You could then bring the not
into the parenthesis by applying one of De Morgan's laws, expressing the preceding test more verbosely as:
if not a and not b and not (c and d):
e()
which could then be further expanded to:
if not a and not b and (not c or not d):
e()
which is what you yourself already expanded to. But I'd find the first version to be more readable.