Robotics & Artificial Intelligence

What will be the output of the code given below:

import numpy as np
arr = np.array([1, 2, 3, 4, 5])
print(arr[2])

Python Modules

1 Like

Answer

3

Working

In a NumPy array, indexing starts from 0. Therefore, arr[2] accesses the element at index position 2, which is 3.

Answered By

3 Likes


Related Questions