#Import the NumPy library
import numpy as np
# Creating a matrix
A = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
# Computing the eigenvalues and eigenvectors of the matrix
eigenvalues, eigenvectors = np.linalg.eig(A)
# Computing the rank of the matrix
rank = np.sum(np.abs(eigenvalues) > 1e-10)
print(rank) # Output: 2