xxxxxxxxxx
def each_cons(lst, n):
print(range(len(lst) - n + 1))
for i in range(len(lst) - n + 1):
print(i, i+n)
print(lst[i:i+n])
return [lst[i:i+n] for i in range(len(lst) - n + 1)]
print(each_cons([1, 2, 3, 4], 2))
print(each_cons([1, 2, 3, 4], 3))
#Output
[[1, 2], [2, 3], [3, 4]]
[[1, 2, 3], [2, 3, 4]]