Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

in and not in operators python

exactly on which containers can the in operator be applied?
Generally the rule of thumb is (not a fact but a doctrine):
if container is iterable => in can be applied 
 ex. of such containers- (str, list, tuple, set and dict)
#note1:
by iterable i mean we can iterate like this:
for x in list_object: or for y in dict_obj:
#note2:
not in operator just have opposite definition to that of in 
but above rule of thumb is true for not in as well ofcourse.
Source by www.py4e.com #
 
PREVIOUS NEXT
Tagged: #operators #python
ADD COMMENT
Topic
Name
2+8 =