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)creating a spiral array in python?
I want to create a sub array based on a chosen entry in this array. if we choose the 04 entry,
subarray[x][y] == 04
subarray[x][y] == TheSpiral[x-1:x+2,y-1:y+2]
print_matrix(TheSpiral)
print_matrix(subarray)
However I get an error message due to not properly defining subarray. I was expecting the print_matrix(subarray) to yield
06 01 02
05 04 03
16 15 14
which is why I used #TheSpiral[x-1:x+2,y-1:y+2]. Thanks for the help.