1. Home
  2. Data Science
  3. NumPy
  4. What is the result of np.arange(5)?

Added 24 Feb 2024

What is the result of np.arange(5)?

  1. [0, 1, 2, 3, 4] Correct answer
  2. [1, 2, 3, 4, 5]
  3. [0, 1, 2, 3]
  4. [1, 2, 3, 4]

Correct answer

A. [0, 1, 2, 3, 4]

12 views

MCQSEXAM

Explanation

np.arange(5) returns [0, 1, 2, 3, 4]. Like Python's range(), it starts at 0 by default and stops before the given value, so five numbers are produced.

The full form is np.arange(start, stop, step).

Keep preparing with more Data Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More NumPy MCQs

Practise all NumPy MCQs

Similar MCQs