Complete the code to create a list named fruits with three items: 'apple', 'banana', and 'cherry'.
fruits = [1]Lists in Python are created using square brackets []. So, ['apple', 'banana', 'cherry'] is the correct way to create a list with these items.
Complete the code to create an empty list named numbers.
numbers = [1]An empty list is created with empty square brackets [].
Fix the error in the code to correctly create a list named colors with 'red', 'green', and 'blue'.
colors = [1]The code must use square brackets to create a list. Parentheses create tuples, curly braces create sets, and just commas create a syntax error.
Fill both blanks to create a list of squares for numbers 1 to 5 using list comprehension.
squares = [x[1] for x in range(1, 6) if x [2] 3]
The expression x**2 calculates the square of x. The condition x > 3 filters numbers greater than 3.
Fill all three blanks to create a dictionary where keys are uppercase words and values are their lengths, but only for words longer than 4 letters.
result = { [1]: [2] for word in words if len(word) [3] 4 }word instead of word.upper() for keys.word instead of len(word) for values.<= or < instead of > in the condition.The key is the uppercase word using word.upper(). The value is the length with len(word). The condition filters words longer than 4 letters using >.