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

  • برمجة بايثون

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

الأجوبة

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
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...