find index of values greater than python

Solutions on MaxInterview for find index of values greater than python by the best coders in the world

showing results for - "find index of values greater than python"
Lisa
12 Aug 2020
1>>> [i for i,v in enumerate(a) if v > 4]
2[4, 5, 6, 7, 8]
3#enumerate returns the index and value of each item in an array. 
4#So if the value v is greater than 4, include the index i in the new array.