multiline pre in numpy questions
This commit is contained in:
@ -18,25 +18,25 @@ print(b)
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```python
|
<pre>
|
||||||
[[1.0 2.0 3.0]
|
[[1.0 2.0 3.0]
|
||||||
[3.0 4.0 5.0]]
|
[3.0 4.0 5.0]]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```python
|
<pre>
|
||||||
[[1. 2. 3.]
|
[[1. 2. 3.]
|
||||||
[3. 4. 5.]]
|
[3. 4. 5.]]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```python
|
<pre>
|
||||||
[[1. 3.]
|
[[1. 3.]
|
||||||
[2. 4.]
|
[2. 4.]
|
||||||
[3. 5.]
|
[3. 5.]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ videoId: 0jGfH8BPfOk
|
|||||||
|
|
||||||
What is another way to produce the following array?
|
What is another way to produce the following array?
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[[0. 0. 0. 0. 0. 0. 0.]
|
[[0. 0. 0. 0. 0. 0. 0.]
|
||||||
[0. 1. 1. 1. 1. 1. 0.]
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
[0. 1. 1. 1. 1. 1. 0.]
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
@ -19,7 +19,7 @@ What is another way to produce the following array?
|
|||||||
[0. 1. 1. 1. 1. 1. 0.]
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
[0. 1. 1. 1. 1. 1. 0.]
|
[0. 1. 1. 1. 1. 1. 0.]
|
||||||
[0. 0. 0. 0. 0. 0. 0.]]
|
[0. 0. 0. 0. 0. 0. 0.]]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
@ -19,23 +19,23 @@ print(np.full_like(a, 100))
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[[100 100 100 100 100]]
|
[[100 100 100 100 100]]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[[100 100 100 100 100]
|
[[100 100 100 100 100]
|
||||||
[100 100 100 100 100]]
|
[100 100 100 100 100]]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[[ 1 2 3 4 5]
|
[[ 1 2 3 4 5]
|
||||||
[ 6 7 20 9 10]]
|
[ 6 7 20 9 10]]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -11,16 +11,16 @@ videoId: tUdBZ7pF8Jg
|
|||||||
|
|
||||||
Given a file named `data.txt` with these contents:
|
Given a file named `data.txt` with these contents:
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
29,97,32,100,45
|
29,97,32,100,45
|
||||||
15,88,5,75,22
|
15,88,5,75,22
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
What code would produce the following array?
|
What code would produce the following array?
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[29. 32. 45. 15. 5. 22.]
|
[29. 32. 45. 15. 5. 22.]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ videoId: VNWAQbEM-C8
|
|||||||
|
|
||||||
What code would produce the following array?
|
What code would produce the following array?
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[[1. 1.]
|
[[1. 1.]
|
||||||
[1. 1.]
|
[1. 1.]
|
||||||
[1. 1.]
|
[1. 1.]
|
||||||
[1. 1.]]
|
[1. 1.]]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user