Complete the code to get the number of elements in the list.
length = length([1])The length function returns the number of elements in the list. Here, the list has 3 elements.
Complete the code to flatten a list of lists into a single list.
flat_list = flatten([1])The flatten function takes a list of lists and combines all inner lists into one single list.
Fix the error in the merge function to combine two maps correctly.
combined = merge([1], {"key2" = "value2"})
The merge function requires maps as arguments. Option C is a valid map with key-value pairs.
Fill both blanks to create a map with keys as strings and values as lengths of words longer than 4 characters.
result = { [1] : length([2]) for word in words if length(word) > 4 }The key should be the variable word itself (not a string literal), and the value is the length of that word.
Fill all three blanks to create a merged map with uppercase keys and values greater than 3.
filtered = { [1] : [2] for k, v in merge(map1, map2) if [3] }The keys are converted to uppercase with k.upper(), values are v, and the filter keeps values greater than 3.