Complete the code to find the difference between set_a and set_b.
set_a = {1, 2, 3, 4}
set_b = {3, 4, 5, 6}
difference = set_a.[1](set_b)
print(difference)The difference method returns elements in set_a that are not in set_b.
Complete the code to find the symmetric difference between set_x and set_y.
set_x = {10, 20, 30}
set_y = {20, 40, 50}
sym_diff = set_x.[1](set_y)
print(sym_diff)The symmetric_difference method returns elements in either set but not in both.
Fix the error in the code to correctly find the difference of set_m and set_n.
set_m = {7, 8, 9}
set_n = {8, 10}
diff = set_m.[1](set_n)
print(diff)The correct method name is difference. Misspelled names cause errors.
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 = {word: [1] for word in words if len(word) [2] 3} print(lengths)
Use len(word) to get length and > to filter words longer than 3 letters.
Fill all three blanks to create a dictionary with uppercase words as keys and their lengths as values, only for words with length greater than 4.
words = ['tree', 'house', 'car', 'elephant'] result = { [1]: [2] for word in words if len(word) [3] 4 } print(result)
Keys are uppercase words (word.upper()), values are lengths (len(word)), filtered by length > 4.