Finding the index of elements based on a condition using python list comprehension,a[:] = [x for x in a if x <= 2]