Added a fancy indexing solution for 16

This commit is contained in:
Amin Sehati 2026-02-09 08:54:37 -05:00
parent 4a3372ed11
commit d421b9750c

View File

@ -165,6 +165,11 @@ Z = np.ones((5,5))
Z = np.pad(Z, pad_width=1, mode='constant', constant_values=0)
print(Z)
# Not a solution to this problem but good to know: using fancy indexing for in-place edit
Z[:, [0, -1]] = 0
Z[[0, -1], :] = 0
print(Z)
< q17
What is the result of the following expression? (★☆☆)
```python