Python’s not
operator means that you can invert the fact worth of Boolean expressions and objects. You should utilize this operator in Boolean contexts, equivalent to if
statements and whereas
loops. It additionally works in non-Boolean contexts, which lets you invert the reality worth of your variables.
Utilizing the not
operator successfully will aid you write correct unfavourable Boolean expressions to manage the circulate of execution in your applications.
On this course, you’ll be taught:
- How Python’s
not
operator works - Methods to use the
not
operator in Boolean and non-Boolean contexts - Methods to use the
operator.not_()
operate to carry out logical negation - How and when to keep away from pointless unfavourable logic in your code