Membership
operators are used to test whether a value or variable is found in a sequence (string,
list, tuple, set and dictionary).
Operator
|
Description
|
in
|
Return
true if value/variable is found in the sequence, else false.
|
not in
|
Return True
if value/variable is not found in the sequence, else false
|
>>> primeNumbers = [2, 3, 5, 7, 11] >>> 2 in primeNumbers True >>> 4 in primeNumbers False >>> 4 not in primeNumbers True
No comments:
Post a Comment