Complete the code to create a NumPy array from the list.
import numpy as np numbers = [1, 2, 3, 4, 5] arr = np.[1](numbers)
Use np.array() to convert a list into a NumPy array.
Complete the code to add 5 to every element in the array using vectorization.
import numpy as np arr = np.array([1, 2, 3, 4, 5]) result = arr [1] 5
Adding 5 to every element is done with the + operator in vectorized form.
Fix the error in the code to multiply each element by 2 using vectorization.
import numpy as np arr = np.array([1, 2, 3]) result = arr [1] 2
Use the * operator for element-wise multiplication in NumPy arrays.
Fill both blanks to create a dictionary with words as keys and their lengths as values, but only for words longer than 3 letters.
words = ['apple', 'bat', 'carrot', 'dog'] lengths = {word: [1] for word in words if len(word) [2] 3}
Use len(word) to get the length and filter words with length greater than 3 using >.
Fill all three blanks to create a dictionary with uppercase words as keys and their lengths as values, only for words longer than 3 letters.
words = ['apple', 'bat', 'carrot', 'dog'] lengths = { [1]: [2] for word in words if len(word) [3] 3 }
Use word.upper() for keys, len(word) for values, and filter words with length greater than 3 using >.