From 4a3372ed11a4e876a373b09084018f75cc531ac3 Mon Sep 17 00:00:00 2001 From: Amin Sehati <76731670+amin-sehati@users.noreply.github.com> Date: Sun, 8 Feb 2026 16:58:53 -0500 Subject: [PATCH 1/2] Remove an incorrect solution (fancy indexing) from Numpy exercise No. 16 in the solutions files. --- 100_Numpy_exercises_with_hints_with_solutions.md | 5 ----- 100_Numpy_exercises_with_solutions.md | 5 ----- source/exercises100.ktx | 5 ----- 3 files changed, 15 deletions(-) diff --git a/100_Numpy_exercises_with_hints_with_solutions.md b/100_Numpy_exercises_with_hints_with_solutions.md index 3c6d409..89d4f81 100644 --- a/100_Numpy_exercises_with_hints_with_solutions.md +++ b/100_Numpy_exercises_with_hints_with_solutions.md @@ -130,11 +130,6 @@ print(Z) Z = np.ones((5,5)) Z = np.pad(Z, pad_width=1, mode='constant', constant_values=0) print(Z) - -# Using fancy indexing -Z[:, [0, -1]] = 0 -Z[[0, -1], :] = 0 -print(Z) ``` #### 17. What is the result of the following expression? (★☆☆) ```python diff --git a/100_Numpy_exercises_with_solutions.md b/100_Numpy_exercises_with_solutions.md index 3ab3c91..b502669 100644 --- a/100_Numpy_exercises_with_solutions.md +++ b/100_Numpy_exercises_with_solutions.md @@ -130,11 +130,6 @@ print(Z) Z = np.ones((5,5)) Z = np.pad(Z, pad_width=1, mode='constant', constant_values=0) print(Z) - -# Using fancy indexing -Z[:, [0, -1]] = 0 -Z[[0, -1], :] = 0 -print(Z) ``` #### 17. What is the result of the following expression? (★☆☆) ```python diff --git a/source/exercises100.ktx b/source/exercises100.ktx index c0f1648..111a381 100644 --- a/source/exercises100.ktx +++ b/source/exercises100.ktx @@ -165,11 +165,6 @@ Z = np.ones((5,5)) Z = np.pad(Z, pad_width=1, mode='constant', constant_values=0) print(Z) -# Using fancy indexing -Z[:, [0, -1]] = 0 -Z[[0, -1], :] = 0 -print(Z) - < q17 What is the result of the following expression? (★☆☆) ```python From d421b9750c33b6619ea304ddbbc489b8e1b2d4dc Mon Sep 17 00:00:00 2001 From: Amin Sehati <76731670+amin-sehati@users.noreply.github.com> Date: Mon, 9 Feb 2026 08:54:37 -0500 Subject: [PATCH 2/2] Added a fancy indexing solution for 16 --- source/exercises100.ktx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/exercises100.ktx b/source/exercises100.ktx index 111a381..9af07a9 100644 --- a/source/exercises100.ktx +++ b/source/exercises100.ktx @@ -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