Randell Dawson d94b3010e3
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>
2020-10-01 22:08:57 +01:00

943 B

id, title, challengeType, videoId
id title challengeType videoId
5e9a0a8e09c5df3cc3600ed6 Initialize Array Problem 11 0jGfH8BPfOk

Description

Tests

question:
  text: |
    What is another way to produce the following array?

    ```py
    [[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((7, 7))

      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((7, 7))

      z = np.zeros((5, 5))
      z[3, 3] = 5

      output[1:-1, 1:-1] = z
      ```
  solution: 2