Jan-17-2022, 05:04 PM
Looks like you're asking about a subsequence. You can check if a slice of a list matches your subsequence.
list_1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] win_1 = ["1", "2", "3", "4"] if any(win_1 == list_1[x:x+len(win_1)] for x in range(len(list_1) - len(win_1) + 1)): print("yes")List slicing and list comparison can take a while. So this can be expensive as the lists get long.