Complete the code to create an empty list for evaluation examples.
evaluation_examples = [1]We use square brackets [] to create an empty list in Python, which is suitable for storing evaluation examples.
Complete the code to add a dictionary with input and output to the evaluation examples list.
evaluation_examples.append([1])Evaluation examples are stored as dictionaries with keys like input and output. So we add a dictionary to the list.
Fix the error in the code to create a list of evaluation examples with two entries.
evaluation_examples = [[1]]Inside the list brackets, multiple dictionaries are separated by commas without extra brackets.
Complete the code to create a dictionary comprehension that filters evaluation examples with input length greater than 3.
filtered_examples = {word:len(word) for word in evaluation_examples if len(word['input']) [1] 3}= instead of : in dictionary comprehension.< or =.In dictionary comprehensions, : separates key and value. The condition checks if input length is greater than 3 using >.
Complete the code to create a list comprehension extracting outputs for inputs containing 'test'.
test_outputs = [example['output'] for example in evaluation_examples if 'test' [1] example['input']]
not in instead of in for the condition.The list comprehension starts with [ and ends with ]. The condition uses in to check if 'test' is in the input string.