About 762,000 results
Bokep
- Viewed 178k times80edited Feb 3, 2017 at 17:12
You could solve this many ways. One that is pretty simple to understand is to just use a loop.
def comp(list1, list2):for val in list1:if val in list2:return Truereturn FalseA more compact way you can do it is to use map and reduce:
reduce(lambda v1,v2: v1 or v2, map(lambda v: v in list2, list1))Even better, the reduce can be replaced with any:
any(map(lambda v: v in list2, list1))You could also use sets:
len(set(list1).intersection(list2)) > 0Content Under CC-BY-SA license Explore further
- Question & Answer
5 Best Ways to Check if a List is Contained in Another List in …
WEBNov 7, 2021 · In this tutorial, you’ll learn how to use Python to check if a list contains an item. Put differently, you’ll learn if an item exists in a Python list. Being able to determine if a Python list contains a particular …
- People also ask
Python list contains: How to check if an item exists in list?
Python check if list contains elements of another list
Python List Contains Elements of Another List - TechBeamers
Python List Contains: How to Check if an Item is in a List
Python Check If a List Contains Elements of Another List
Python List Contains – Check if Element Exists in List
Write a Python Program to Check Whether a List Contains a Sublist
Python – Check if List Contains all Elements of Another List
Python - Test if List contains elements in Range - GeeksforGeeks
python - Can I check if a list contains any item from another list ...
Python : Check if a list contains all the elements of another list
10 Python Function Practice Exercises for Beginners
python - How to test if a list contains another list as a contiguous ...
sqlite3 — DB-API 2.0 interface for SQLite databases - Python
How To Set Up a Python Virtual Environment on Windows 10
How do I check if one list contains 2 elements of another list?
python - How to check if a string in a list is present in another one ...
Related searches for python check if list contains another
- Some results have been removed