title: Python - How to replace adjacent list elements with a different value
body: <p>I have been stumped trying to figure how to locate and change the values of the area bordered around a single element of an list without affecting the element values needing to be bordered. </p>
  
  <p>This is what I'm trying to achieve:</p>
  
  <p>BEFORE:</p>
  
  <pre><code>[[0,0,0,0,0],
   [0,1,1,0,0],
   [0,1,0,1,0],
   [0,0,1,0,0],
   [0,0,0,0,0]]
  </code></pre>
  
  <p>AFTER:</p>
  
  <pre><code>[[9,9,9,9,0],
   [9,1,1,9,9],
   [9,1,9,1,9],
   [9,9,1,9,9],
   [0,9,9,9,0])
  </code></pre>
  
  <p>I just need to know if I need mainly <code>for</code> loops as well as <code>if/else</code> statements, or if I need a separate library to get this solved. </p>
  
  <p>Thanks in advance for helping!</p>