﻿ NumPy: Find the position of the index of a specified value greater than existing value in NumPy array - w3resource # NumPy: Find the position of the index of a specified value greater than existing value in NumPy array

## NumPy: Array Object Exercise-118 with Solution

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

Sample Solution:

Python Code:

``````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
```

Pictorial Presentation-1: Pictorial Presentation-2: Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Set comprehension:

```>>> m = {x ** 2 for x in range(5)}
>>> m
{0, 1, 4, 9, 16}
```