TABLE 4-8
Python Membership Operators
Operator
Description
Example
in
Determines whether the value in the left operand
appears in the sequence found in the right operand
“Hello” in “Hello Goodbye”
is True
not in
Determines whether the value in the left operand is
missing from the sequence found in the right operand
“Hello” not in “Hello Goodbye”
is False
TABLE 4-9
Python Identity Operators
Operator
Description
Example
is
Evaluates to true when the type of the value or
expression in the right operand points to the same
type in the left operand
type(2) is int is True
is not
Evaluates to true when the type of the value or
expression in the right operand points to a different
type than the value or expression in the left operand
type(2) is not int is False
76
Do'stlaringiz bilan baham: |