Updated question 37, keep previous solution for reference

This commit is contained in:
Francesco Terenzi 2021-04-09 10:50:11 +02:00
parent a7c84d5fed
commit 025845ff5c
5 changed files with 224 additions and 209 deletions

File diff suppressed because it is too large Load Diff

View File

@ -354,6 +354,11 @@ print(np.trunc(Z))
`hint: np.arange` `hint: np.arange`
```python ```python
Z = np.zeros((5,5))
Z += np.arange(5)
print(Z)
# without broadcasting
Z = np.tile(np.arange(0, 5), (5,1)) Z = np.tile(np.arange(0, 5), (5,1))
print(Z) print(Z)
``` ```

View File

@ -354,6 +354,11 @@ print(np.trunc(Z))
```python ```python
Z = np.zeros((5,5))
Z += np.arange(5)
print(Z)
# without broadcasting
Z = np.tile(np.arange(0, 5), (5,1)) Z = np.tile(np.arange(0, 5), (5,1))
print(Z) print(Z)
``` ```

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "68fdc73a", "id": "9187d1fe",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# 100 numpy exercises\n", "# 100 numpy exercises\n",
@ -18,7 +18,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "fb354250", "id": "7b3fced0",
"metadata": {}, "metadata": {},
"source": [ "source": [
"File automatically generated. See the documentation to update questions/answers/hints programmatically." "File automatically generated. See the documentation to update questions/answers/hints programmatically."
@ -26,7 +26,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "a6d059d8", "id": "77575766",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Run the `initialize.py` module, then call a random question with `pick()` an hint towards its solution with\n", "Run the `initialize.py` module, then call a random question with `pick()` an hint towards its solution with\n",
@ -36,7 +36,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "390f283b", "id": "bcf0dd93",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -46,7 +46,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "ac498ee7", "id": "f401c090",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [

View File

@ -451,6 +451,11 @@ Create a 5x5 matrix with row values ranging from 0 to 4 (★★☆)
hint: np.arange hint: np.arange
< a37 < a37
Z = np.zeros((5,5))
Z += np.arange(5)
print(Z)
# without broadcasting
Z = np.tile(np.arange(0, 5), (5,1)) Z = np.tile(np.arange(0, 5), (5,1))
print(Z) print(Z)