In this question there is a good answer on how to check if a list is contained in another list.
However how can I check if a list is contained in another list but taking into account the order?
For example
a= [1,2,3,5]
b= [1,2,3,4,5]
if set(a).issubset(b):
print('a is contained in b')
else:
print('No')
gives me obviously "a is contained in b"
Unfortunately if a= [1,3,2,5]
it gives me the same result
I would like the following
- a=[1,3,2,5] -> No
- a=[1,2,3,5] -> Yes
- a=[3,4,5] -> yes
- a=[1,2,4,3,5] -> No
- a=[1,2,3,4,5] -> Yes