Python finding n consecutive numbers in a list
<p>I want to know how to find if there is a certain amount of consecutive numbers in a row in my list e.g.</p>

<p>For example if I am looking for two 1's then:</p>

<pre><code>list = [1, 1, 1, 4, 6] #original list
list = ["true", "true", 1, 4, 6] #after my function has been through the list.
</code></pre>

<p>If I am looking for three 1's then:</p>

<pre><code>list = [1, 1, 1, 4, 6] #original list
list = ["true", "true", "true", 4, 6] #after my function has been through the list.
</code></pre>

<p>I have tried:</p>

<pre><code>list = [1, 1, 2, 1]

1,1,1 in list #typed into shell, returns "(1, 1, True)"
</code></pre>

<p>Any help would be greatly appreciated, I mainly would like to understand whats going on, and how to check if the next element in the list is the same as the first x amount.</p>
