# get index of value in list if value meet condition python

>>> import numpy as np >>> a = np.array([1, 2, 3, 1, 2, 3]) >>> np.where(a > 2)[0] [2 5]

**Here is what the above code is Doing:**

1. np.where(a > 2) returns a tuple of arrays, one for each dimension of a, containing the indices where the condition is true.

2. [0] at the end is to return the indices of the first dimension of the array.