import numpy as np
x = np.array([1, 3, 5, 7, 0])
print("Original array: ")
print(x)
print("Difference between neighboring elements, element-wise of the said array.")
print(np.diff(x))
Sample Output:
Original array:
[1 3 5 7 0]
Difference between neighboring elements, element-wise of the said array.
[ 2 2 2 -7]
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer