Complete the code to create a simple list of data entries.
data = [[1]]We use a list of strings to represent multiple data entries. Option D correctly shows a list containing three string items.
Complete the code to add a new record to the database list.
database = ['record1', 'record2'] database.[1]('record3')
The append method adds a single item to the end of a list, which is what we want here.
Fix the error in the code to retrieve the first record from the database list.
first_record = database[1]0
To access an item by index in a list, we use square brackets []. So database[0] gets the first item.
Fill both blanks to create a dictionary that organizes data by ID.
database = [1] 1: 'Alice', 2: 'Bob', 3: 'Charlie' [2]
Dictionaries use curly braces {} to hold key-value pairs. So the code starts with { and ends with }.
Fill both blanks to filter records with IDs greater than 1.
filtered = {k: v for k, v in database.items() if k [1] [2]The condition k > 1 filters keys greater than 1.