Complete the code to apply a map operation that doubles each number in the RDD.
rdd2 = rdd.[1](lambda x: x * 2)
The map operation applies a function to each element in the RDD, here doubling each number.
Complete the code to filter out all numbers less than 5 from the RDD.
filtered_rdd = rdd.[1](lambda x: x >= 5)
The filter operation keeps only elements that satisfy the condition, here numbers greater or equal to 5.
Fix the error in the code to correctly flatten a list of words from sentences using flatMap.
words = sentences.[1](lambda sentence: sentence.split(' '))
flatMap applies the function and flattens the resulting lists into a single RDD of words.
Complete the code to create a dictionary of words and their lengths, but only for words longer than 3 characters.
word_lengths = {word: len(word) for word in words if len(word) [1] 3}The colon : separates keys and values in a dictionary. The condition > filters words longer than 3 characters.
Fill all three blanks to create a dictionary with uppercase words as keys, their original words as values, but only for words longer than 4 characters.
result = [1]: [2] for word in words if len(word) [3] 4}
The key is the uppercase word (word.upper()), the value is the original word (word), and the condition keeps words longer than 4 characters (>).