In this python numpy program, we will find the ith element of an array using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create an array using np.array().
- Find the ith element of an array using indexing and logic.
- Print the output.
import numpy as np
x = np.array([[4,8,7],[2,3,6]])
print("Fifth element: ",x[1,1])
Output :
Fifth element: 3