python any of one list in another list code example
Example 1: check if a list contains an item from another list python
list_A = [1, 2, 3, 4]
list_B = [2, 3, 6]
check = any(item in list_A for item in list_B)
print(check)
Example 2: python check if list contains elements of another list
list_A = [1, 2, 3, 4]
list_B = [2, 3]
check = all(item in list_A for item in list_B)
print(check)
Example 3: how to check if a list contains elements in another list
list1 = [2,4,0,7,6]
list2 = [1,0,9,7,6]
check = any(element in list2 for element in list1)