Answers for "python check list intens in another list"

3

python check if list contains elements of another list

## checking all elements of list_B in list_A
list_A = [1, 2, 3, 4]
list_B = [2, 3]

check = all(item in list_A for item in list_B)

print(check)
# True
Posted by: Guest on May-17-2020
2

python check list contains another list

>>> items = set([-1, 0, 1, 2])
>>> set([1, 2]).issubset(items)
True
>>> set([1, 3]).issubset(items)
False
Posted by: Guest on April-16-2021

Code answers related to "python check list intens in another list"

Python Answers by Framework

Browse Popular Code Answers by Language