Pour obtenir le contraire d'un booléen en python, on peut utiliser l'opérateur logique not:
>>> cond = True
>>> type(cond)
<class 'bool'>
>>> cond
True
>>> cond = not cond
>>> cond
False
Références
Liens | Site |
---|---|
not | programiz.com |
How do I get the opposite (negation) of a Boolean in Python? | stackoverflow |