I'm facing a problem when trying to assign a specific value to a 100x100 2d array. I want it to be zero everywhere except along two segments: first line from the 25th to the 75th and last column from the 25th row to the 75th.
I tried doing it using the ": looping", I mean:
my_array[0][25:75] = 1.
my_array[25:75][99] = 1.
but the second line returns me the error:
IndexError: index 99 is out of bounds for axis 0 with size 50
As if it was first cutting an array of length 50 (75-25) and then assigning with it.
Of course I can get what I want using:
for x in xrange(25,75):
my_array[x][-1] = 1.
But, out of curiosity, how could I get it done with : manipulation?