Skip to content

Commit

Permalink
Merge pull request #280 from MZuhairKhan/patch-1
Browse files Browse the repository at this point in the history
Update numpy.rst
  • Loading branch information
bast authored Apr 17, 2024
2 parents 1937431 + 6f3a3a5 commit 6945c91
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions content/numpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,11 @@ Additional exercises
5. Let's test those functions with few negative and positive values::

a = np.array([-3.3, -2.5, -1.5, -0.75, -0.5, 0.5, 0.75, 1.5, 2.5, 3])
np.round(a)
np.ceil(a)
np.floor(a)
np.trun(a)
np.round(a) # [-3. -2. -2. -1. -0. 0. 1. 2. 2. 3.]
np.ceil(a) # [-3. -2. -1. -0. -0. 1. 1. 2. 3. 3.]
np.floor(a) # [-4. -3. -2. -1. -1. 0. 0. 1. 2. 3.]
np.trunc(a) # [-3. -2. -1. -0. -0. 0. 0. 1. 2. 3.]


6. One solution is::

Expand Down

0 comments on commit 6945c91

Please sign in to comment.