extracting sub array of array
<p>Hi my question is in regards to the J.F. Sebastian code and discussion below.
I am trying to print a sub array of an array.  The code is below and my update is on the bottom. (It gives error messages)<a href="https://stackoverflow.com/questions/36834505/creating-a-spiral-array-in-python">creating a spiral array in python?</a></p>

<p>I want to create a sub array based on a chosen entry in this array. if we choose the 04 entry,</p>

<pre><code>subarray[x][y] == 04
subarray[x][y] == TheSpiral[x-1:x+2,y-1:y+2]

print_matrix(TheSpiral)  
print_matrix(subarray)
</code></pre>

<p>However I get an error message due to not properly defining subarray.  I was expecting the print_matrix(subarray) to yield</p>

<pre><code>06 01 02
05 04 03
16 15 14
</code></pre>

<p>which is why I used #TheSpiral[x-1:x+2,y-1:y+2].  Thanks for the help.</p>