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>pull/39780/head
parent
48c41e5a6a
commit
d94b3010e3
|
@ -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
|
||||
````
|
||||
|
||||
</section>
|
||||
|
|
Loading…
Reference in New Issue