- __contain__() is a python function which search the item in the given list and on this basis it return the True or False.
Syntax-
list.__contain__(item)
-It will return True if item is present in the list
-It will return Fasle if item is not in the given list.
Example
list is [1,2,3]
list.__contain__(3) will return True.
list.__contain__(8) will return False.
program-
l=[1,2,3,"one","two"]
print(l.__contains__(2))
print(l.__contains__(2))
print(l.__contains__(6))
print(l.__contains__("one"))
True
True
False
True