fix(curriculum): convert all video challenges to markdown (#39189)

This commit is contained in:
Shaun Hamilton
2020-08-04 20:56:41 +01:00
committed by GitHub
parent e7d2028bba
commit 7d8e558b91
69 changed files with 711 additions and 345 deletions

View File

@ -7,16 +7,18 @@ videoId: v-7Y7koJ_N0
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: |
What code would change the values in the 3rd column of both of the following Numpy arrays to 20?:
What code would change the values in the 3rd column of both of the following Numpy arrays to 20?
```py
a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
@ -27,15 +29,22 @@ question:
```
answers:
- |
`a[:, 3] = 20`
```python
a[:, 3] = 20
```
- |
`a[2, :] = 20`
```python
a[2, :] = 20
```
- |
`a[:, 2] = 20`
```python
a[:, 2] = 20
```
- |
`a[1, 2] = 20`
```python
a[1, 2] = 20
```
solution: 3
```
````
</section>

View File

@ -7,21 +7,41 @@ videoId: f9QrZrKQMLI
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: 'What will the following code print?:<pre>b = np.array([[1.0,2.0,3.0],[3.0,4.0,5.0]])<br>print(b)</pre>'
text: |
What will the following code print?
```python
b = np.array([[1.0,2.0,3.0],[3.0,4.0,5.0]])
print(b)
```
answers:
- '<pre>[[1.0 2.0 3.0]<br>[3.0 4.0 5.0]]<pre>'
- '<pre>[[1. 2. 3.]<br>[3. 4. 5.]]<pre>'
- '<pre>[[1. 3.]<br>[2. 4.]<br>[3. 5.]<pre>'
- |
```python
[[1.0 2.0 3.0]
[3.0 4.0 5.0]]
```
- |
```python
[[1. 2. 3.]
[3. 4. 5.]]
```
- |
```python
[[1. 3.]
[2. 4.]
[3. 5.]
```
solution: 2
```
````
</section>

View File

@ -7,16 +7,18 @@ videoId: iIoQ0_L0GvA
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: |
What is the value of `a` after running the following code?:
What is the value of `a` after running the following code?
```py
import numpy as np
@ -28,13 +30,18 @@ question:
answers:
- |
`[1 2 3 4 5]`
```python
[1 2 3 4 5]
```
- |
`[1 2 20 4 5]`
```python
[1 2 20 4 5]
```
- |
`[1 20 3 4 5]`
```python
[1 20 3 4 5]
```
solution: 2
```
````
</section>

View File

@ -7,18 +7,20 @@ videoId: 0jGfH8BPfOk
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: |
What is another way to produce the following array?:
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.]
@ -55,7 +57,6 @@ question:
output[4:1, 4:1] = z
```
solution: 1
```
````
</section>

View File

@ -7,16 +7,18 @@ videoId: CEykdsKT4U4
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: |
What will the following code print?:
What will the following code print?
```py
a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
@ -25,21 +27,20 @@ question:
```
answers:
- |
```
```py
[[100 100 100 100 100]]
```
- |
```
```py
[[100 100 100 100 100]
[100 100 100 100 100]]
```
- |
```
```py
[[ 1 2 3 4 5]
[ 6 7 20 9 10]]
```
solution: 2
```
````
</section>

View File

@ -7,13 +7,15 @@ videoId: tUdBZ7pF8Jg
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: |
Given a file named `data.txt` with these contents:
@ -23,7 +25,7 @@ question:
15,88,5,75,22
```
What code would produce the following array?:
What code would produce the following array?
```py
[29. 32. 45. 15. 5. 22.]
@ -31,28 +33,27 @@ question:
answers:
- |
```
```py
filedata = np.genfromtxt('data.txt', delimiter=',')
output = np.any(filedata < 50)
print(output)
```
- |
```
```py
filedata = np.genfromtxt('data.txt', delimiter=',')
output = np.all(filedata < 50, axis=1)
print(output)
```
- |
```
```py
filedata = np.genfromtxt('data.txt', delimiter=',')
output = filedata[filedata < 50]
print(output)
```
solution: 3
```
````
</section>

View File

@ -7,16 +7,18 @@ videoId: 7txegvyhtVk
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: |
What is the value of `b` after running the following code?:
What is the value of `b` after running the following code?
```py
import numpy as np
@ -26,12 +28,23 @@ question:
```
answers:
- '10'
- '7'
- '5'
- '15'
- |
```py
10
```
- |
```py
7
```
- |
```py
5
```
- |
```py
15
```
solution: 4
```
````
</section>

View File

@ -7,18 +7,20 @@ videoId: VNWAQbEM-C8
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
````yml
question:
text: |
What code would produce the following array?:
What code would produce the following array?
```
```py
[[1. 1.]
[1. 1.]
[1. 1.]
@ -44,7 +46,6 @@ question:
print(b)
```
solution: 1
```
````
</section>

View File

@ -7,22 +7,29 @@ videoId: 5Nwfs5Ej85Q
---
## Description
<section id='description'>
</section>
## Tests
<section id='tests'>
```yml
question:
text: 'Why are Numpy arrays faster than regular Python lists?:'
text: |
Why are Numpy arrays faster than regular Python lists?
answers:
- Numpy does not perform type checking while iterating through objects.
- Numpy uses fixed types.
- Numpy uses contiguous memory.
- All of the above.
- |
Numpy does not perform type checking while iterating through objects.
- |
Numpy uses fixed types.
- |
Numpy uses contiguous memory.
- |
All of the above.
solution: 4
```
</section>