Check if values in list exceed threshold a certain amount of times and return index of first exceedance
<p>I am searching for a clean and pythonic way of checking if the contents of a list are greater than a given number (first threshold) for a certain number of times (second threshold). If both statements are true, I want to return the index of the first value which exceeds the given threshold.</p>

<p><strong>Example</strong>:</p>

<pre><code># Set first and second threshold
thr1 = 4
thr2 = 5

# Example 1: Both thresholds exceeded, looking for index (3)
list1 = [1, 1, 1, 5, 1, 6, 7, 3, 6, 8]

# Example 2: Only threshold 1 is exceeded, no index return needed
list2 = [1, 1, 6, 1, 1, 1, 2, 1, 1, 1]
</code></pre>

<pre><code>thr1 = 4
thr2 = 5
list1 = [1, 1, 1, 5, 1, 6, 7, 3, 6, 8]
list2 = [1, 1, 6, 1, 1, 1, 2, 1, 1, 1]

def func(lst)
    res = [ i for i,j in enumerate(lst) if j &gt; thr1]
    return len(res)&gt;=thr2 and res[0]
</code></pre>

<p>Output:</p>

<pre><code>func(list1)
3
func(list2)
false
</code></pre>

python list iterator threshold