Write a NumPy program to create a random vector of size 10 and sort it.
import numpy as np x = np.random.random(10) print("Original array:") print(x) x.sort() print("Sorted array:") print(x)
Sample Output:
Original array: [ 0.73123073 0.67714015 0.95615347 0.4759837 0.88789818 0.69104042 0.59996415 0.26144489 0.51618644 0.89943882] Sorted array: [ 0.26144489 0.4759837 0.51618644 0.59996415 0.67714015 0.69104042 0.73123073 0.88789818 0.89943882 0.95615347]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer