How do I check if all items in a 2D list are all the same?
<p>I need help checking if all the items in a two-dimensional list are the same (in this case, I'm checking if they are all equal to one).</p>

<p>I made a function <code>allOnes(L)</code> that checks if all items are 1's in a 1D array. I used the all() function like this:</p>

<pre><code>def allOnes(L):
    """Tests to see if the numbers in the list L are all 1's
    """
    return all(x == 1 for x in L)
</code></pre>

<p>Now I need to check if all items in a 2D list are all 1's. I would like the function allOnes2d to return True when it checks a list like this: <code>[[1,1,1], [1,1,1], [1,1,1]]</code>. Is this possible using <code>all()</code>? </p>
