Complete the code to import NumPy with its common alias.
import [1] as np
NumPy is commonly imported as np to simplify code when using its functions.
Complete the code to convert a Python list to a NumPy array.
arr = np.[1]([1, 2, 3, 4])
The np.array() function converts a list into a NumPy array.
Fix the error in the code to import the train_test_split function from scikit-learn.
from sklearn.model_selection import [1]
The correct function name is train_test_split from sklearn.model_selection.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.
{word: [1] for word in words if len(word) [2] 3}The dictionary comprehension maps each word to its length using len(word). The condition filters words with length greater than 3 using >.
Fill all three blanks to create a dictionary comprehension that maps uppercase keys to values only if values are positive.
result = [1]: [2] for k, v in data.items() if v [3] 0}
k.lower() instead of uppercase.The comprehension uses k.upper() to convert keys to uppercase, keeps values as v, and filters for values greater than zero using >.