check if elements of a list exists in another list python code example
Example 1: 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
Example 2: how to check if a list contains elements in another list
##Taking examples of two python lists.
##Take examples of two lists.
list1 = [2,4,0,7,6]
list2 = [1,0,9,7,6]
##the statement for condition is.
check = any(element in list2 for element in list1)