Write a NumPy program to find indices of elements equal to zero in a NumPy array
- برمجة بايثون
- 2021-09-13
- mhanasmh00489829403
الأجوبة
import numpy as np
nums = np.array([1,0,2,0,3,0,4,5,6,7,8])
print("Original array:")
print(nums)
print("Indices of elements equal to zero of the said array:")
result = np.where(nums == 0)[0]
print(result)
Sample Output:
Original array: [1 0 2 0 3 0 4 5 6 7 8] Indices of elements equal to zero of the said array: [1 3 5]
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال