Given a list of lists, the task is to determine whether the given element exists in any sublist or not. Given below are a few methods to solve the given task.
Method #1: Using any()
any() method return true whenever a particular element is present in a given iterator.
Method #2: Using operator in
The ‘in’ operator is used to check if a value exists in a sequence or not. Evaluates to true if it finds a variable in the specified sequence and false otherwise.
Method #3: Using
Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted.
- Python | Check if a list exists in given list of lists
- Check if element exists in list in Python
- Python | Program to count number of lists in a list of lists
- Python | Zipping two lists of lists
- Python - Convert Lists into Similar key value lists
- Python | Remove given element from list of lists
- Python | Merge two list of lists according to first element
- Python | Maximum sum of elements of list in a list of lists
- Python | Ways to sum list of lists and return sum list
- Python | Convert list into list of lists
- Python | Sorting list of lists with similar list elements
- Python | Merge List with common elements in a List of Lists
- Python | Convert List of lists to list of Strings
- Python - Convert Key-Value list Dictionary to List of Lists
- Python - Convert List of Dictionaries to List of Lists
- Python | Check if two lists have at-least one element common
- Python | Check if two lists have any element in common
- Python | Concatenate two lists element-wise
- Python - Diagonal element addition among lists
- Python | Check whether given key already exists in a dictionary
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.