I am trying to determine if List1=[0,0,0]
is contained within List2
or List3
in the most efficient manner that I can and where:
List2=[34, 32, 25, 0, 0, 0, 32]
with results True
List3=[34, 32, 25, 0, 32, 0, 0]
with results False
I have tried set().subset
but it returns True and True, I tried if List1 in List2
and get False
I know I can iterate through the list and do value,sequence comparisons but was wondering if there was already a function that did this kind of comparison and if not could this be done with a fairly simple lambda expression?
Note: List2
and List3
can be a lot longer those are just short examples showing the difference and more precisely what it is I am looking for