>>836
def f(n, a):return [a[i:i + n] for i in range(len(a)-n+1)]

print( f(3,[3,1,4,1,5]))
---
[[3, 1, 4], [1, 4, 1], [4, 1, 5]]