title: Simple Mine-Sweeper using python. Mine in proximity function
body: <p>I'm trying to improve my code for finding mines in proximity in a mine-sweeper "game" on python.
  It works, but I was wondering if there is anyway to improve it whilst still using dictionaries. 
  I personally think the code could be better but can't really see how to do it better.
  Thanks :D</p>
  
  <pre><code>grid = {}
  grid[(0, 7)] = "Mine"
  grid[(1, 5)] = "Mine"
  grid[(1, 6)] = "Mine"
  grid[(1, 8)] = "Mine"
  grid[(2, 4)] = "Mine"
  grid[(3, 4)] = "Mine"
  grid[(5, 5)] = "Mine"
  grid[(7, 0)] = "Mine"
  grid[(7, 5)] = "Mine"
  
  
  def mine_in_proximity(position, grid):
      death = False
      count = 0
      i, j = position[0], position[1]
      for n in range(i-1, i+2):
          for m in range(j-1, j+2):
              if (n, m) != (i, j):
                  mine = grid.get((n, m), 0)
                  if mine == "Mine":
                      count += 1
                  elif mine == 0:
                      grid[position] = count
              else:
                  deadly = grid.get((n, m), 0)
                  if deadly == "Mine":
                      death = True
      return count, grid, death
  </code></pre>