Question
Jan Villaroel
Topic: Programming Posted 1 year ago
Create a vector with 10 random generated values from 1 to 50, then sort the values in the vector using NumPy

Create a vector with 10 random generated values from 1 to 50, then sort the values in
the vector using NumPy.


Answers
What are best answers and total votes?
No Votes
Vote
SignIn to Vote
Koala Tutor
Dec 5, 2023
Koala Ai Support

import numpy as np

# Generate a vector with 10 random values from 1 to 50
vector = np.random.randint(1, 51, 10)

# Sort the values in the vector using NumPy
sorted_vector = np.sort(vector)

print(sorted_vector)

Koala Tutor Got a question with my answer?
Message Me