Complete the code to split the array into 3 equal parts.
import numpy as np arr = np.array([1, 2, 3, 4, 5, 6]) splits = np.split(arr, [1])
We want to split the array into 3 equal parts, so the second argument to np.split should be 3.
Complete the code to split the array at the specified indices.
import numpy as np arr = np.array([10, 20, 30, 40, 50]) splits = np.split(arr, [1])
The array will be split at indices 1 and 3, creating subarrays: [10], [20, 30], and [40, 50].
Fix the error in the code to split the array into 4 parts.
import numpy as np arr = np.array([1, 2, 3, 4, 5, 6, 7, 8]) splits = np.split(arr, [1])
To split into 4 parts, we provide indices where to split: [2, 4, 6].
Fill both blanks to create a dictionary with 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 }
The dictionary keys are the words themselves, and the values are their lengths.
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 [3] }
Keys are uppercase words, values are lengths, and condition filters words longer than 3 letters.