Operational relationships: That is, the comparison operation is often said, the return value is only true, False
= = Whether the judgment is equal
! = Determine if not equal
>,<, >=, <= judgment is greater than, less than, greater than or equal to, less than or equal to
Comparison operator Precedence is all the same
From left to right
Logical operations: basic terminology constructs complex conditions
And and
OR OR
Not opposite
Priority: not > and > or
A b A and b A or B not a
True arbitrary value B value a value false
False arbitrary value a value B value true
Short Circuit calculation:
For and, when the left operand is false, the right operand is shorted and will not be computed
For or, when the left operand is true, the right operand is shorted and is not evaluated
Identity operator: is, the term to determine whether two identifiers from the same entity, the principle is to compare the ID of two objects, if the same, true, otherwise false
Is isn't the opposite
The ID () function can get the ID of the object
= = Determines whether two variable values are equal, but the IDs are not necessarily equal
Member operators:
In: Returns TRUE if the specified value is found in the specified sequence, otherwise false
Not in: Returns TRUE if the specified value is not found in the specified sequence, otherwise false
The basics of Python programming seven