Complete the code to find the index of the number 7 in the list.
numbers = [3, 7, 1, 9] index = numbers.[1](7) print(index)
The index() method returns the position of the first occurrence of the value.
Complete the code to check if the word 'apple' is in the list.
fruits = ['banana', 'apple', 'cherry'] if 'apple' [1] fruits: print('Found it!')
The keyword in checks if an item exists in a list.
Fix the error in the code to find the position of 5 in the list.
values = [2, 4, 5, 6] position = values.[1](5) print(position)
The correct method to find the index of an element in a list is index().
Fill both blanks to create a dictionary of word lengths for words longer than 3 letters.
words = ['cat', 'house', 'tree', 'a'] lengths = {word: [1] for word in words if len(word) [2] 3}
Use len(word) to get the length and > to filter words longer than 3 letters.
Fill all three blanks to create a dictionary of uppercase words and their lengths for words longer than 2 letters.
words = ['dog', 'cat', 'a', 'bird'] result = { [1]: [2] for w in words if len(w) [3] 2 }
Use w.upper() for uppercase keys, len(w) for values, and > to filter words longer than 2 letters.