Solution for Q10 is not entirely correct.
santiqwerty opened this issue · 1 comments
santiqwerty commented
10. Find indices of non-zero elements from [1,2,0,0,4,0] (★☆☆)
I think the solution should return at least an array with the indices. Something like this:
nz = np.nonzero([1,2,0,0,4,0])
print(nz[0])
which returns [0 1 4]
instead of
nz = np.nonzero([1,2,0,0,4,0])
print(nz)
which returns (array([0, 1, 4], dtype=int64),)
rougier commented
Thansk for your comment. The point of the question is to illustrate the use of nonzero
. People are then free to use the results as they want.