
When you have a list of elements, there can be cases when you need to check whether there an element is part of a list or not.
You can do this using in
checker.
Let us see this in action. Let us assume that we have a list and we want to check whether a number is part of that list.
my_first_list = [1, 3, 5, 7, 9]
print(50 in my_first_list) # False
There is also not in
which you can use to check whether an element is not part of a list.
Let us see this in action.
my_first_list = [1, 3, 5, 7, 9]
print(50 not in my_first_list) # True
That’s basically it.
I hope you find it useful.