I have a list of indices,
ind = [0,1,2,5,6,7]
And another list of my data:
data = [0,1,4,9,16,25,36,49,64]
I'd like to only keep the indices of data
that correspond to the values in list
:
result = [0,1,4,25,36,49]
Or reworded, delete the indices in data
that aren't in the values of list
.
I think there's some kind of list comprehension I could do but I can't figure it out! Thanks,