arr = [3, -2, -4, -9, 0, 3, 7, 13, 8, -3] max = 0 K = 3 for x in range(len(arr)-K+1): if max < sum(arr[x:x+K-1]): max = sum(arr[x:x+K-1]) print(max)
To embed this project on your website, copy the following code and paste it into your website's HTML: