i think there is a typo in the first box, it says np.arrange instead of arrange.
Course: https://www.educative.io/courses/from-python-to-numpy
Lesson: Indexing in NumPy - From Python to Numpy
i think there is a typo in the first box, it says np.arrange instead of arrange.
Course: https://www.educative.io/courses/from-python-to-numpy
Lesson: Indexing in NumPy - From Python to Numpy
Hi @Elaina_Jeansonne !!
Its not typo here. np.arange()
is a function in the NumPy library of Python that returns an array of evenly spaced values within a given interval. The syntax for using np.arange() is: np.arange([start,] stop[, step,], dtype=None)
.
In the case of np.arange(9)
, the start parameter is not specified, so the default value of 0 is used. The stop parameter is set to 9, which means that the array will contain values from 0 to 8. The step parameter is also not specified, so the default value of 1 is used.
Therefore, the output of np.arange(9)
would be an array containing values from 0 to 8 with a step of 1, and z[0]
will return 0
.
I hope it helps. Happy Learning