Here is my code:
def sliding_window(seq, size, step):
l = []
return sliding_window_rec(seq, size, step, l)
def sliding_window_rec(seq, size, step, l):
if len(seq) < size:
return l
else:
l.append(seq[:size])
seq = seq[step:]
sliding_window_rec(seq, size, step, l)
print(sliding_window(seq, size, step))
This prints None.
If I add print(l) inside the function sliding_window_rec, it prints a list. So why does it return None and not a list when I do return l?