Complete the code to start a simple search by checking if the keyword is in the document.
if '[1]' in document: print('Keyword found!')
The code checks if the keyword is present in the document text.
Complete the code to add a document to the search index dictionary.
search_index['[1]'] = document_text
Documents are stored in the index using a unique doc_id as the key.
Fix the error in the code that searches for documents containing the keyword.
for doc_id, text in search_index.items(): if '[1]' in text: print(f'Document {doc_id} matches')
The code must check if the keyword is in the document text to find matches.
Fill both blanks to create a dictionary comprehension that maps each word to its length if the length is greater than 3.
{word: [1] for word in words if [2]The comprehension maps each word to its length only if the length is greater than 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their frequency if frequency is more than 1.
{ [1]: [2] for [3] in word_freq.items() if [2] > 1 }The comprehension maps each word (converted to uppercase) to its frequency if the frequency is more than 1.