Rest API - Rate Limiting and Throttling
The following code tries to implement a sliding window sum but has a bug. What is the error?
data = [2, 4, 6, 8]
window_size = 2
result = []
for i in range(len(data) - window_size):
window_sum = sum(data[i:i+window_size])
result.append(window_sum)
print(result)