Complete the code to create an RDD from a Python list.
data = [1, 2, 3, 4, 5] rdd = sc.[1](data)
The parallelize method creates an RDD from an existing Python collection like a list.
Complete the code to create an RDD by reading a text file.
rdd = sc.[1]("/path/to/file.txt")
The textFile method reads a text file and creates an RDD where each element is a line.
Fix the error in the code to create an RDD from a list of numbers.
numbers = [10, 20, 30] rdd = sc.[1](numbers).collect()
To create an RDD from a list, use parallelize. The other methods are for files or do not exist.
Fill both blanks to create an RDD from a list and filter even numbers.
data = [1, 2, 3, 4, 5] rdd = sc.[1](data).filter(lambda x: x [2] 2 == 0)
Use parallelize to create the RDD and the modulus operator % to check even numbers.
Fill all three blanks to create an RDD from a file, map each line to uppercase, and collect the results.
rdd = sc.[1]("/path/to/file.txt") upper_rdd = rdd.[2](lambda line: line.[3]()) result = upper_rdd.collect()
Use textFile to read the file, map to apply a function to each line, and upper to convert text to uppercase.