Code Room
Code reviewMedium
Question
Review this Python sliding-window sum that produces the sum of every contiguous window of size k.
Called in a metrics pipeline; `k` is user-configurable.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
def window_sums(a, k): sums = [] s = sum(a[:k]) sums.append(s) for i in range(k, len(a)): s += a[i] - a[i - k] sums.append(s) return sumsRun or narrate your approach, then ask the coach.