What does the np.linspace() function do in NumPy?
Correct answer
A. Generates an array of equally spaced numbers over a specified interval
14 views
A. Generates an array of equally spaced numbers over a specified interval
14 views
np.linspace() generates equally spaced numbers over a specified interval: np.linspace(0, 1, 5) gives [0, 0.25, 0.5, 0.75, 1]. The endpoint is included by default.
Unlike arange(), you specify how many points you want, not the step size.
Want more practice? Try the full set of Data Science MCQs on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.