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>
This commit is contained in:
@ -20,42 +20,44 @@ question:
|
|||||||
What is another way to produce the following array?
|
What is another way to produce the following array?
|
||||||
|
|
||||||
```py
|
```py
|
||||||
[[1. 1. 1. 1. 1.]
|
[[0. 0. 0. 0. 0. 0. 0.]
|
||||||
[1. 0. 0. 0. 1.]
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
[1. 0. 9. 0. 1.]
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
[1. 0. 0. 0. 1.]
|
[0. 1. 1. 5. 1. 1. 0.]
|
||||||
[1. 1. 1. 1. 1.]]
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
|
[0. 0. 0. 0. 0. 0. 0.]]
|
||||||
```
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- |
|
- |
|
||||||
```py
|
```py
|
||||||
output = np.ones((5, 5))
|
output = np.ones((7, 7))
|
||||||
|
|
||||||
z = np.zeros((3, 3))
|
z = np.zeros((5, 5))
|
||||||
z[1, 1] = 9
|
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
|
output[1:-1, 1:-1] = z
|
||||||
```
|
```
|
||||||
- |
|
- |
|
||||||
```py
|
```py
|
||||||
output = np.ones((5, 5))
|
output = np.ones((7, 7))
|
||||||
|
|
||||||
z = np.zeros((3, 3))
|
z = np.zeros((5, 5))
|
||||||
z[1, 1] = 9
|
z[3, 3] = 5
|
||||||
|
|
||||||
output[1:3, 1:3] = z
|
output[1:-1, 1:-1] = z
|
||||||
```
|
```
|
||||||
- |
|
solution: 2
|
||||||
```py
|
|
||||||
output = np.ones((5, 5))
|
|
||||||
|
|
||||||
z = np.zeros((3, 3))
|
|
||||||
z[1, 1] = 9
|
|
||||||
|
|
||||||
output[4:1, 4:1] = z
|
|
||||||
```
|
|
||||||
solution: 1
|
|
||||||
````
|
````
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
Reference in New Issue
Block a user