title: How does one test if a matrix in Python has only 1's and 0's?
body: <p>Let's say I've got a matrix like this:</p>
  
  <pre><code>mat1 = np.array([1,0,1], [1,1,0], [0,0,0]);
  </code></pre>
  
  <p>And I've got another one like this:</p>
  
  <pre><code>mat2 = np.array([0,1,0], [0,0,1], [1,1,1]);
  </code></pre>
  
  <p>I want to detect if something like</p>
  
  <pre><code>np.add(mat1, mat2);
  </code></pre>
  
  <p>has only 1's or 0's, namely some 1's and some 0's, all 0's, or all 1's.</p>
  
  <hr>
  
  <p><em>n.b.</em> - Comment your code.</p>