Question: 
Write a function to extract specified number of elements from a given list, which follow each other continuously.


Model's Code:
def extract_elements(lst, n):
    result = []
    count = 1
    
    for i in range(1, len(lst)):
        if lst[i] == lst[i - 1]:
            count += 1
        else:
            if count >= n:
                result.append(lst[i - 1])
            count = 1
            
    if count >= n:
        result.append(lst[-1])
        
    return result



Sample Correct Code:
from itertools import groupby 
def extract_elements(numbers, n):
    result = [i for i, j in groupby(numbers) if len(list(j)) == n] 
    return result


Asserts:
assert extract_elements([1, 1, 3, 4, 4, 5, 6, 7],2)==[1, 4]
assert extract_elements([0, 1, 2, 3, 4, 4, 4, 4, 5, 7],4)==[4]
assert extract_elements([0,0,0,0,0],5)==[0]


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 898 of 974: 692/898 (77.06013363028953%): success