I want to check if the list1 is a sublist to list2 in the same order. The most important thing is that objects must be in the same sequence.
For Examples, these are two list:
list1=[1,2,3]
list2=[8,9,1,2,3,6,5]
which should give me True when checked,because objects 1,2 nad 3 are in the same sequence in list1 as in list2.
In other side:
list1=[2,3,1]
list2=[1,2,3]
This should give me False as the order is not the same in list2.
So far I have made that:
def sublist(list1,list2):
s1=" ".join(str(i) for i in list1)
s2=" ".join(str(i) for i in list2)
if s1 in s2:
return True
else:
return False