From d94b3010e3ae0230a90049b47083384818e8df79 Mon Sep 17 00:00:00 2001 From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Date: Thu, 1 Oct 2020 14:08:57 -0700 Subject: [PATCH] fix(learn): changed question to be different from the video (#39773) * fix(learn): changed test to be different from the video the array on the test and it's solution were same as the video explanation, replaced the test with one suggested in #39097 * fix to use np,ones Co-authored-by: Nitin <67074979+nitnjain@users.noreply.github.com> Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> --- .../numpy/initialize-array-problem.md | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/curriculum/challenges/english/08-data-analysis-with-python/numpy/initialize-array-problem.md b/curriculum/challenges/english/08-data-analysis-with-python/numpy/initialize-array-problem.md index d2ae486862..d9ec566b72 100644 --- a/curriculum/challenges/english/08-data-analysis-with-python/numpy/initialize-array-problem.md +++ b/curriculum/challenges/english/08-data-analysis-with-python/numpy/initialize-array-problem.md @@ -20,42 +20,44 @@ question: What is another way to produce the following array? ```py - [[1. 1. 1. 1. 1.] - [1. 0. 0. 0. 1.] - [1. 0. 9. 0. 1.] - [1. 0. 0. 0. 1.] - [1. 1. 1. 1. 1.]] + [[0. 0. 0. 0. 0. 0. 0.] + [0. 1. 1. 1. 1. 1. 0.] + [0. 1. 1. 1. 1. 1. 0.] + [0. 1. 1. 5. 1. 1. 0.] + [0. 1. 1. 1. 1. 1. 0.] + [0. 1. 1. 1. 1. 1. 0.] + [0. 0. 0. 0. 0. 0. 0.]] ``` answers: - | ```py - output = np.ones((5, 5)) + output = np.ones((7, 7)) - z = np.zeros((3, 3)) - z[1, 1] = 9 + z = np.zeros((5, 5)) + z[2, 2] = 5 + + output[1:1, -1:-1] = z + ``` + - | + ```py + output = np.zeros((7,7)) + + z = np.ones((5, 5)) + z[2, 2] = 5 output[1:-1, 1:-1] = z ``` - | ```py - output = np.ones((5, 5)) + output = np.ones((7, 7)) - z = np.zeros((3, 3)) - z[1, 1] = 9 + z = np.zeros((5, 5)) + z[3, 3] = 5 - output[1:3, 1:3] = z + output[1:-1, 1:-1] = z ``` - - | - ```py - output = np.ones((5, 5)) - - z = np.zeros((3, 3)) - z[1, 1] = 9 - - output[4:1, 4:1] = z - ``` - solution: 1 + solution: 2 ````