Complete the code to transpose the matrix using NumPy.
import numpy as np matrix = np.array([[1, 2], [3, 4]]) transposed = matrix[1]
The .T attribute transposes the matrix by swapping rows and columns.
Complete the code to transpose the matrix using the transpose() function.
import numpy as np matrix = np.array([[5, 6, 7], [8, 9, 10]]) transposed = np.[1](matrix)
The np.transpose() function returns the transpose of the input matrix.
Fix the error in the code to correctly transpose the matrix.
import numpy as np matrix = np.array([[1, 2], [3, 4]]) transposed = matrix.transpose[1]
The transpose method requires parentheses () to be called as a function.
Fill both blanks to create a dictionary with words as keys and their lengths as values, only for words longer than 3 characters.
words = ['data', 'is', 'fun', 'and', 'cool'] lengths = {word: [1] for word in words if [2]
word > 3 compares string to number, which is invalid.word.length is not valid in Python.Use len(word) to get the length and filter words with length greater than 3.
Fill all three blanks to create a dictionary with uppercase words as keys and their lengths as values, only for words longer than 3 characters.
words = ['apple', 'bat', 'carrot', 'dog'] result = { [1]: [2] for w in words if [3] }
w.lower() instead of uppercase keys.Use w.upper() for keys, len(w) for values, and filter words with length greater than 3.