Python Not In

Python not in is used to test if a value is not present in a sequence

>>> x = 3
>>> x not in [5, 3, 8]
False
>>> x not in [8, 9, 12]
True

It can be used to test if a value is not present in a list, a tuple, or a set:

>>> 3 not in (4, 8, 9)
True
>>> 3 not in set([4, 8, 9])
True

It can also be used to test if a key is not present in a dictionary:

>>> 'a' not in {'b': 3, 'c': 4}
True
>>> 'a' not in {'a': 3, 'b': 4}
False