How can I check the content of a list with step 3 by 3? : I need to write a function that given a list of integers `L` and integer `n`, it returns `True` if the list contains a consecutive sequence of ones of length `n`, and `False` otherwhise.

Let's say my list is : `L = [1,2,3,4,1,1,1,2,3,4]` and `n` = 3.
The function should return `True` because there are 3 ones at the 5th position.

I tried with:

    def consecutive (L,n):
        for i in range(len(L)):
            if [1]*n in L:
                return True
        return False
    L = [1,2,3,4,1,1,1,2,3,4]
    n = 3
    consecutive (L,n)

But this is not working of course, because `[1]*3` generate `[1,1,1]` and there are not sublist inside `L`.

Is there any way using list comprehension? Something like:

    L = [1,2,3,4,1,1,1,2,3,4]
    result = all(x==(1,1,1) for x in range(0,len(L)+1,3))
    result
Again, I know is not working because each element `x` can't be equal to `(1,1,1)`. I wrote it down just to give an idea of what was in my mind. 