Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CON-2288 - update numpy subejct and audit #2286

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions subjects/ai/numpy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,20 @@ The goal of this exercise is to learn to access values of n-dimensional arrays e
[1, 1, 1, 1, 1, 1, 1, 1, 1]], dtype=int8)
```

3. Using **broadcasting** create the ouptu matrix starting from these two arrays:

```python
array_1 = np.array([1,2,3,4,5], dtype=int8)
array_2 = np.array([1,2,3], dtype=int8)
...
# output matrix
array([[ 1, 2, 3],
[ 2, 4, 6],
[ 3, 6, 9],
[ 4, 8, 12],
[ 5, 10, 15]], dtype=int8)
```

https://jakevdp.github.io/PythonDataScienceHandbook/ (section: Computation on Arrays: Broadcasting)

---
Expand Down
20 changes: 19 additions & 1 deletion subjects/ai/numpy/audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,31 @@ https://jakevdp.github.io/PythonDataScienceHandbook/ (section: The Basics of Num

Here is an example of a possible solution:

```console
```python
x[1:8,1:8] = 0
x[2:7,2:7] = 1
x[3:6,3:6] = 0
x[4,4] = 1
```

###### For question 3, is the output the following?

```console
array([[ 1, 2, 3],
[ 2, 4, 6],
[ 3, 6, 9],
[ 4, 8, 12],
[ 5, 10, 15]], dtype=int8)
```

##### The solution of question 3 is not accepted if the values of the array have been changed one by one manually. The usage of the for loop is not allowed neither.

Here is an example of a possible solution:

```python
np.reshape(arr_1, (5, 1)) * arr_2
```

---

---
Expand Down
Loading