Priority level
1. And and 2. or or 3. Not non-
Operation
Keep in mind that the number nonzero is false for true , and true to true false for false.
or: On the contrary, any one is true, the same false is False (because to check whether there is true, so false case value is the last False value , for example: 0 or False is false;false or 0 is 0. The true case value is the first truth , for example: 0 or 1 or 2 is 1;0 or False or 2 is 2)
And: Contrary to or, any one false is false, the same is true (because to check whether there is a false, so the real case value is the last truth , for example: True and 1 is 1;1 and true is true.) False Case value is the first false value , for example: 0 and 1 and 2 for 0;true and false for False;true and 0 and false for 0)
Not: Negates the result of a high-priority operation , the value is Boolean (2 is true, negation is false: false)
Not 2:false
Not 1 and 2:false
Not 1 or 2:false
Not 1:true
Not 0:true
In fact, not just Python, all languages follow this logic.
operator not, and, or in Python