import numpy as nparr = np.array([1, 0, 1, 0, 0, 2, 0, 3, 1]) print(np.convolve(arr, [1, 1, 1], 'valid'))
Standard input is empty
[2 1 1 2 2 5 4]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!