Merge branch 'rougier:master' into q78_edit
This commit is contained in:
commit
93a34b49b1
File diff suppressed because it is too large
Load Diff
@ -96,15 +96,6 @@ print(Z)
|
|||||||
Z = np.random.random((3,3,3))
|
Z = np.random.random((3,3,3))
|
||||||
print(Z)
|
print(Z)
|
||||||
```
|
```
|
||||||
`hint: np.random.default_rng().random`
|
|
||||||
```python
|
|
||||||
# Author: KnightSnape
|
|
||||||
|
|
||||||
rng = np.random.default_rng()
|
|
||||||
Z = rng.random((3, 3, 3))
|
|
||||||
print(Z)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 13. Create a 10x10 array with random values and find the minimum and maximum values (★☆☆)
|
#### 13. Create a 10x10 array with random values and find the minimum and maximum values (★☆☆)
|
||||||
`hint: min, max`
|
`hint: min, max`
|
||||||
|
|
||||||
@ -956,8 +947,8 @@ Z_start = (np.maximum(Z_start,0)).tolist()
|
|||||||
R_stop = np.maximum(R_start, (R_stop - np.maximum(Z_stop-Zs,0))).tolist()
|
R_stop = np.maximum(R_start, (R_stop - np.maximum(Z_stop-Zs,0))).tolist()
|
||||||
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
|
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
|
||||||
|
|
||||||
r = [slice(start,stop) for start,stop in zip(R_start,R_stop)]
|
r = tuple([slice(start,stop) for start,stop in zip(R_start,R_stop)])
|
||||||
z = [slice(start,stop) for start,stop in zip(Z_start,Z_stop)]
|
z = tuple([slice(start,stop) for start,stop in zip(Z_start,Z_stop)])
|
||||||
R[r] = Z[z]
|
R[r] = Z[z]
|
||||||
print(Z)
|
print(Z)
|
||||||
print(R)
|
print(R)
|
||||||
|
@ -947,8 +947,8 @@ Z_start = (np.maximum(Z_start,0)).tolist()
|
|||||||
R_stop = np.maximum(R_start, (R_stop - np.maximum(Z_stop-Zs,0))).tolist()
|
R_stop = np.maximum(R_start, (R_stop - np.maximum(Z_stop-Zs,0))).tolist()
|
||||||
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
|
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
|
||||||
|
|
||||||
r = [slice(start,stop) for start,stop in zip(R_start,R_stop)]
|
r = tuple([slice(start,stop) for start,stop in zip(R_start,R_stop)])
|
||||||
z = [slice(start,stop) for start,stop in zip(Z_start,Z_stop)]
|
z = tuple([slice(start,stop) for start,stop in zip(Z_start,Z_stop)])
|
||||||
R[r] = Z[z]
|
R[r] = Z[z]
|
||||||
print(Z)
|
print(Z)
|
||||||
print(R)
|
print(R)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "ea6cbc4b",
|
"id": "c1a8ea63",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# 100 numpy exercises\n",
|
"# 100 numpy exercises\n",
|
||||||
@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "354a533b",
|
"id": "8481f467",
|
||||||
"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": "9efa41bf",
|
"id": "7c1a3673",
|
||||||
"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": "1a6e8fdb",
|
"id": "6db52927",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -46,7 +46,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "d1e7d785",
|
"id": "2c9f898f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -1190,8 +1190,8 @@ Z_start = (np.maximum(Z_start,0)).tolist()
|
|||||||
R_stop = np.maximum(R_start, (R_stop - np.maximum(Z_stop-Zs,0))).tolist()
|
R_stop = np.maximum(R_start, (R_stop - np.maximum(Z_stop-Zs,0))).tolist()
|
||||||
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
|
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
|
||||||
|
|
||||||
r = [slice(start,stop) for start,stop in zip(R_start,R_stop)]
|
r = tuple([slice(start,stop) for start,stop in zip(R_start,R_stop)])
|
||||||
z = [slice(start,stop) for start,stop in zip(Z_start,Z_stop)]
|
z = tuple([slice(start,stop) for start,stop in zip(Z_start,Z_stop)])
|
||||||
R[r] = Z[z]
|
R[r] = Z[z]
|
||||||
print(Z)
|
print(Z)
|
||||||
print(R)
|
print(R)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user