How to solve this

Get all the elements from a that are between 5 - 10.
a = np.random.randint(0,15, size=(4,4))

a[np.where((a >= 5) & (a <= 10))]

a[(a >= 5) & (a <= 10)]

a[np.all((a >= 5) & (a <= 10))]

a[np.any((a >= 5) & (a <= 10))]

Both A and B are correct

hey @ajaysiddartha ,
can you please let what actually is your doubt regarding this. ?

in randint() function i think the third arguement shold be the no of elments to be printed in range…
what does those functions mean where,any…?
it is not even covered …
and most of the question in quiz are not covered …

hey @ajaysiddartha ,
if you have look here. You will get to know about parameters more properly.

These are some functions provided by numpy to search / compare values based on conditions.

and about this , i would say that there are many things that are not provided but still you search about them and learn. Similarly mentors have made these quizes like this that atleast you search about and learn about new things .

I hope this helped you :slightly_smiling_face:.

1 Like