Skip to content

Commit 6299b28

Browse files
authored
Update numpy.rst
Fixed solution to Exercise 5, Q 5. trun -> trunc Additionally, added the solutions from when the example code is run.
1 parent ae875c0 commit 6299b28

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

content/numpy.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,11 @@ Additional exercises
465465
5. Let's test those functions with few negative and positive values::
466466

467467
a = np.array([-3.3, -2.5, -1.5, -0.75, -0.5, 0.5, 0.75, 1.5, 2.5, 3])
468-
np.round(a)
469-
np.ceil(a)
470-
np.floor(a)
471-
np.trun(a)
468+
np.round(a) // [-3. -2. -2. -1. -0. 0. 1. 2. 2. 3.]
469+
np.ceil(a) // [-3. -2. -1. -0. -0. 1. 1. 2. 3. 3.]
470+
np.floor(a) // [-4. -3. -2. -1. -1. 0. 0. 1. 2. 3.]
471+
np.trunc(a) // [-3. -2. -1. -0. -0. 0. 0. 1. 2. 3.]
472+
472473

473474
6. One solution is::
474475

0 commit comments

Comments
 (0)