Complete the code to define the map function that processes input key-value pairs.
def map([1], value): # process input key and value pass
The map function takes a key and a value as input parameters. The first parameter is usually called key.
Complete the code to emit intermediate key-value pairs from the map function.
def map(key, value): words = value.split() for word in words: [1](word, 1)
In the map phase, the function emit is used to output intermediate key-value pairs.
Fix the error in the map function to correctly split the input value into words.
def map(key, value): words = value.[1]() for word in words: emit(word, 1)
The split() method breaks a string into a list of words, which is needed here.
Fill both blanks to create a dictionary comprehension that counts word lengths greater than 3.
lengths = {word: [1] for word in words if len(word) [2] 3 }The dictionary comprehension maps each word to its length if the length is greater than 3.
Fill all three blanks to create a dictionary comprehension filtering words by length and mapping to uppercase keys.
result = { [1]: [2] for word in words if len(word) [3] 4 }The comprehension creates keys as uppercase words, values as the original words, filtering words longer than 4 characters.