How to check if a list is in another list with the same order python

Viewed 3365

My question is different with the typical one. Assume we have,

X = ['123', '456', '789']

And, we want to find whether another list is in X with exact same order. For example,

A = ['123', '456']
# should return True since A in X with same order
B = ['456', '123']
# should return False since elements in B are not in same order with X
C = ['123', '789']
# should return False since elements in C are not adjacent in X

Can anyone give me any idea?

3 Answers
Related