Add an array with itself
Python 3, 67 65 42 bytes
Uses the fact that the sum of an empty array is 0
lambda x,y:[sum(x[i::y])for i in range(y)]
Try it online!
MATL, 4 bytes
e!Xs
Try it online!
First bit of MATL code I've written! Takes two inputs, a
as a row vector (comma-separated) and l
as a number. Works out to be
e # reshape `a` into `l` rows (auto pads with 0)
! # transpose
Xs # sum down the columns
Jelly, 7 6 bytes
1 byte thanks to Dennis.
;0$¡sS
Try it online!