Merge branch 'rougier:master' into q78_edit

This commit is contained in:
Hemanth 2025-07-26 23:14:22 +00:00 committed by GitHub
commit 93a34b49b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 215 additions and 224 deletions

File diff suppressed because it is too large Load Diff

View File

@ -96,15 +96,6 @@ print(Z)
Z = np.random.random((3,3,3))
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 (★☆☆)
`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()
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
r = [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)]
r = tuple([slice(start,stop) for start,stop in zip(R_start,R_stop)])
z = tuple([slice(start,stop) for start,stop in zip(Z_start,Z_stop)])
R[r] = Z[z]
print(Z)
print(R)

View File

@ -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()
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
r = [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)]
r = tuple([slice(start,stop) for start,stop in zip(R_start,R_stop)])
z = tuple([slice(start,stop) for start,stop in zip(Z_start,Z_stop)])
R[r] = Z[z]
print(Z)
print(R)

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "ea6cbc4b",
"id": "c1a8ea63",
"metadata": {},
"source": [
"# 100 numpy exercises\n",
@ -18,7 +18,7 @@
},
{
"cell_type": "markdown",
"id": "354a533b",
"id": "8481f467",
"metadata": {},
"source": [
"File automatically generated. See the documentation to update questions/answers/hints programmatically."
@ -26,7 +26,7 @@
},
{
"cell_type": "markdown",
"id": "9efa41bf",
"id": "7c1a3673",
"metadata": {},
"source": [
"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",
"execution_count": null,
"id": "1a6e8fdb",
"id": "6db52927",
"metadata": {},
"outputs": [],
"source": [
@ -46,7 +46,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d1e7d785",
"id": "2c9f898f",
"metadata": {},
"outputs": [],
"source": [

View File

@ -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()
Z_stop = (np.minimum(Z_stop,Zs)).tolist()
r = [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)]
r = tuple([slice(start,stop) for start,stop in zip(R_start,R_stop)])
z = tuple([slice(start,stop) for start,stop in zip(Z_start,Z_stop)])
R[r] = Z[z]
print(Z)
print(R)