solutions update from a4bf63e
This commit is contained in:
parent
a4bf63e6bc
commit
e865a958ed
File diff suppressed because it is too large
Load Diff
@ -130,6 +130,11 @@ print(Z)
|
||||
Z = np.ones((5,5))
|
||||
Z = np.pad(Z, pad_width=1, mode='constant', constant_values=0)
|
||||
print(Z)
|
||||
|
||||
# Not a solution to this problem but good to know: using fancy indexing for in-place edit
|
||||
Z[:, [0, -1]] = 0
|
||||
Z[[0, -1], :] = 0
|
||||
print(Z)
|
||||
```
|
||||
#### 17. What is the result of the following expression? (★☆☆)
|
||||
```python
|
||||
|
||||
@ -130,6 +130,11 @@ print(Z)
|
||||
Z = np.ones((5,5))
|
||||
Z = np.pad(Z, pad_width=1, mode='constant', constant_values=0)
|
||||
print(Z)
|
||||
|
||||
# Not a solution to this problem but good to know: using fancy indexing for in-place edit
|
||||
Z[:, [0, -1]] = 0
|
||||
Z[[0, -1], :] = 0
|
||||
print(Z)
|
||||
```
|
||||
#### 17. What is the result of the following expression? (★☆☆)
|
||||
```python
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "21aee2db",
|
||||
"id": "a3747e86",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 100 numpy exercises\n",
|
||||
@ -18,7 +18,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9ba95040",
|
||||
"id": "8b9ef9a4",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"File automatically generated. See the documentation to update questions/answers/hints programmatically."
|
||||
@ -26,7 +26,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d2c26b77",
|
||||
"id": "792c1217",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Run the `initialise.py` module, then call a random question with `pick()` an hint towards its solution with\n",
|
||||
@ -36,7 +36,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2fbe49f5",
|
||||
"id": "541f746c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -46,7 +46,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "8a120f51",
|
||||
"id": "d1743adb",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user