These operators provide an easy way to check if a certain object is present in a sequence: string, list, tuple, set, and dictionary.
They are:
in: returnsTrueif the object is presentnot in: returnsTrueif the object is not present
Let’s see a program that shows how each of them is used.
number_list = [1, 2, 4, 5, 6]
print( 1 in number_list)
print( 5 not in number_list)
print( 3 not in number_list)True
False
True