Complete the code to count how many times the number 5 appears in the list.
numbers = [1, 5, 3, 5, 7, 5] count_fives = numbers.[1](5) print(count_fives)
The count method counts how many times a value appears in a list.
Complete the code to check if the word 'apple' is in the list of fruits.
fruits = ['banana', 'orange', 'apple', 'grape'] if 'apple' [1] fruits: print('Found apple!')
The keyword in checks if an item exists in a list.
Fix the error in the code to find the index of the first occurrence of 7 in the list.
values = [4, 7, 2, 7, 9] position = values.[1](7) print(position)
The index method returns the position of the first matching element in a list.
Fill both blanks to create a dictionary with words as keys and their lengths as values, but only for words longer than 4 letters.
word_lengths = {word: [1] for word in words if len(word) [2] 4}Use len(word) to get the length, and > to filter words longer than 4 letters.
Fill all three blanks to create a dictionary with uppercase words as keys and their counts as values, but only for words that appear more than once.
word_counts = { [1] : words.count([2]) for [3] in words if words.count([3]) > 1 }Use word.upper() for keys, count the word itself, and iterate with word.