Numpy - Initialize Array Problem

Tell us what’s happening:

for the initialize array problems in the data analysis section with python
I am not exactly sure what the

output[1:-1, 1:-1] = z

means

this whole thing is the answer i get the first 2 parts.

output = np.zeros((7,7))
z[2,2] = 5
output[1:-1, 1:-1] = z

Thank you!!

Challenge Information:

Numpy - Initialize Array Problem

This isn’t far from the standard python syntax, where it’s possible to assign to slice, for example:

>>> l = [1, 1, 1, 1, 5]
>>> a = [2, 3, 4]
>>> l[1:4] = a
>>> l
[1, 2, 3, 4, 5]

It might help to always think of = statements in terms of:

destination = source
destination <-- source

Whatever is in the source, gets copied over to the destination. In this case you are copying an array into a section of another array.