In this article, we will discuss how to check an item in a Python list. To check an item in the list, we can use the in operator in Python.
Syntax of in operator
item in list
a = [15,30,27,11,5,2] print(5 in a)
fruits = ["apple","orange","mango"] if "mango" in fruits: print("mango found!")
The in operator can be used with strings or tuple.
In conclusion, in Python, it is easy to check an item in the list using the in operator.