Complete the code to import the numpy library with the common alias.
import [1] as np
We import the numpy library as np to use its functions easily.
Complete the code to create a 2x2 numpy array named matrix.
matrix = np.array([1])The matrix must be a 2x2 nested list to create a 2D numpy array.
Fix the error in the code to compute the inverse of the matrix.
inverse = np.linalg.[1](matrix)det which computes determinant, not inverse.solve which solves linear systems.The function np.linalg.inv() computes the inverse of a matrix.
Fill both blanks to create a dictionary with keys as matrix elements and values as their inverses.
inverse_dict = {element: [1] for row in matrix for element in row if element [2] 0}We calculate the inverse of each element by dividing 1 by it, and skip zero elements to avoid division errors.
Fill all three blanks to compute the inverse matrix and print it.
import numpy as np matrix = np.array([1]) inverse = np.linalg.[2](matrix) print([3])
inv.We create a 2x2 matrix, compute its inverse using np.linalg.inv(), and print the inverse matrix.
