title: Optimising the double for-loop to find the count of particular value on 2-dimensional array
body: <p>To calculate the <code>number of blank spaces</code> on board, I need to call the following piece of code every time.  </p>
  
  <pre><code>for i in range(game.width):
          for j in range(game.height):
              if game.__board_state__[i][j] == 0:
                  blank_spaces += 1
  </code></pre>
  
  <p>Currently <code>game.width = 7</code> and <code>game.height = 7</code>. So there is a loop with the complexity of <code>O(width*height)</code>. Is there a builtin function/ or any other way, that is more optimized?</p>