Write a NumPy program to calculate the difference between neighboring elements, element-wise of a given array
- برمجة بايثون
- 2021-09-13
- mhanasmh00489829403
الأجوبة
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]
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال