Complete the code to find the number of times 3 appears in the tuple.
numbers = (1, 3, 5, 3, 7, 3) count = numbers.[1](3) print(count)
index() instead of count().len() on the tuple with a value.The count() method returns how many times a value appears in a tuple.
Complete the code to find the first position of the value 5 in the tuple.
values = (2, 4, 5, 6, 5) position = values.[1](5) print(position)
count() instead of index().find() which is not a tuple method.The index() method returns the first position of a value in a tuple.
Fix the error in the code to correctly find the index of 10 in the tuple.
data = (10, 20, 30) pos = data.[1](10) print(pos)
find() which is a string method, not a tuple method.search() or locate() which do not exist.The correct method to find the index of a value in a tuple is index(). Methods like find() do not exist for tuples.
Fill both blanks to create a dictionary of word lengths for words longer than 3 characters.
words = ('apple', 'bat', 'carrot', 'dog') lengths = {word: [1] for word in words if len(word) [2] 3} print(lengths)
<= instead of > in the condition.Use len(word) to get the length and > to filter words longer than 3 characters.
Fill all three blanks to create a dictionary with uppercase keys and values for positive numbers.
data = {'a': 1, 'b': -2, 'c': 3}
result = [1]: [2] for k, v in data.items() if v [3] 0
print(result)>= or < instead of >.Use k.upper() for uppercase keys, v for values, and > to filter positive values.