I have a pretty big array with unique values from which I need specific values pretty often. The obvious way to do this (at least obvious to me) is:
for value in myarray:
if value == specificvalue:
If my specific value is at position x , this needs x steps to find it. Simple.
But I also happened to stumble across the find() function in array. So I thought of another way:
var neededvalueindex = myarray.find(specificvalue)
var neededvalue = myarray[neededvalueindex]
I guess there are even more ways to achieve what I want, but what I would really like to know, is how I find an efficient (possibly the most efficient) one.
I appreciate any advice on the matter.