Skip to content

Commit 8c7cdb5

Browse files
authored
Merge pull request #251 from rgommers/example-tweak
Make example in interactive shell copy-pastable
2 parents 19f3728 + b7df482 commit 8c7cdb5

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

layouts/partials/shell-lesson.html

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
2-
The standard way to import NumPy:
3-
41
```python
2+
>>> # The standard way to import NumPy:
53
>>> import numpy as np
6-
```
74

8-
Create a 2-D array, set every second element in some rows, and find max per
9-
row:
5+
>>> # Create a 2-D array, set every second element in
6+
>>> # some rows and find max per row:
107

11-
```python
128
>>> x = np.arange(15, dtype=np.int64).reshape(3, 5)
139
>>> x[1:, ::2] = -99
1410
>>> x
@@ -17,10 +13,8 @@
1713
[-99, 11, -99, 13, -99]])
1814
>>> x.max(axis=1)
1915
array([ 4, 8, 13])
20-
```
2116

22-
Generate some random numbers with an exponential distribution:
23-
```python
17+
>>> # Generate normally distributed random numbers:
2418
>>> rng = np.random.default_rng()
25-
>>> samples = rng.exponential(size=2500)
19+
>>> samples = rng.normal(size=2500)
2620
```

0 commit comments

Comments
 (0)