2(ix)
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])
Show SolutionHide Solution↓
3
In a NumPy array, indexing starts from 0. Therefore, arr[2] accesses the element at index position 2, which is 3.