I have an list/array, lets call it x, and I want to create a new list/array, lets call this one z, out of elements from x that match a
x
z
One option is to use list comprehension:
>>> [a for a in x if a < 5] [1, 2, 3, 4]