if not a or (a and b):
print('foo')
Let's talk about it step by step: When is it done print('foo')?
- When
aand bare True. - When
elseis it done, what is it else? The opposite of the previous ifso not a.
, 'foo' .
EDIT: , :
.. , , ! , . ! !;)
if not a or b:
print('foo')
not a True, a True ( or), a and b b ( , a True, a and b True and b, ).