-
Write a function
replace_zeros(A, x)that modifies the arrayA(of any shape) by replacing all zero elements withx. -
Write a function
centered(A)that returns an array made of the arrayA(of any shape) in such a way that from each of its elements it subtracts the arithmetic mean of all elements ofA. The arrayAitself should remain unchanged. -
Write a function
below_diagonal(A)that, for a square arrayA(any size greater than 1), creates a one-dimensional array whose k-th element is the sum of the elements of the k-th column ofAbelow the main diagonal. -
Write a function
checkboard(n)that creates (and returns) a square array NumPy with alternating ones and zeros, of the size given by the invocation argumentn, in the form:>>> checkboard(2) array([[ 1., 0.], [ 0., 1.]]) >>> checkboard(3) array([[ 1., 0., 1.], [ 0., 1., 0.], [ 1., 0., 1.]]) >>> checkboard(4) array([[ 1., 0., 1., 0.], [ 0., 1., 0., 1.], [ 1., 0., 1., 0.], [ 0., 1., 0., 1.]]) >>> checkboard(5) array([[ 1., 0., 1., 0., 1.], [ 0., 1., 0., 1., 0.], [ 1., 0., 1., 0., 1.], [ 0., 1., 0., 1., 0.], [ 1., 0., 1., 0., 1.]])
forked from mds-python/numpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Simple NumPy Exercises
JesFusion/numpy-exercises
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
Simple NumPy Exercises
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%