I have a better way to solve exercise 89
Author: anthonyduong9Created Sep 30, 2024Updated Oct 23, 2024
I think
print(np.sort(Z)[-n:])or
Z.sort()
print(Z[-n:])would be better than
because the first solution is simpler, and if it's ok to modify the array in place, the second solution is faster and uses less space.
Source: rougier/numpy-100