Q:

Write a NumPy program to find the position of the index of a specified value greater than existing value in NumPy array

0

Write a NumPy program to find the position of the index of a specified value greater than existing value in NumPy array.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np    
n= 4
nums = np.arange(-6, 6)
print("\nOriginal array:")
print(nums)
print("\nPosition of the index:")
print(np.argmax(nums>n/2))

Sample Output:

Original array:
[-6 -5 -4 -3 -2 -1  0  1  2  3  4  5]

Position of the index:
9

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now