This conv loops over range(len(signal)), so the last window runs off
the end of the signal and produces a bogus partial result. The window
can only be placed where it fully fits: len(signal) - len(kernel) + 1
positions. Fix line 4.
Expected output:
[0, -5, 0]
The break is on line 4 — but read the whole snippet first.