* 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>
64 lines
943 B
Markdown
64 lines
943 B
Markdown
---
|
|
id: 5e9a0a8e09c5df3cc3600ed6
|
|
title: Initialize Array Problem
|
|
challengeType: 11
|
|
videoId: 0jGfH8BPfOk
|
|
---
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
</section>
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
````yml
|
|
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
|
|
````
|
|
|
|
</section>
|