chore(i8n,learn): processed translations
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
15047f2d90
commit
e5c44a3ae5
@ -1,5 +1,6 @@
|
||||
---
|
||||
id: 5e9a0a8e09c5df3cc3600ed6
|
||||
title: Initialize Array Problem
|
||||
challengeType: 11
|
||||
videoId: 0jGfH8BPfOk
|
||||
dashedName: initialize-array-problem
|
||||
@ -12,20 +13,33 @@ dashedName: initialize-array-problem
|
||||
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
|
||||
```
|
||||
@ -33,26 +47,15 @@ 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
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```py
|
||||
output = np.ones((5, 5))
|
||||
|
||||
z = np.zeros((3, 3))
|
||||
z[1, 1] = 9
|
||||
|
||||
output[4:1, 4:1] = z
|
||||
output[1:-1, 1:-1] = z
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
1
|
||||
2
|
||||
|
||||
|
Reference in New Issue
Block a user