Complete the code to generate a compliance report header.
report_header = "Compliance Report - [1]"
The header should include the month and year for clarity, so "April 2023" fits best.
Complete the code to filter logs for compliance checks.
filtered_logs = [log for log in logs if log['[1]'] == 'ERROR']
Logs usually have a 'level' field indicating severity like ERROR or INFO.
Fix the error in the code to generate a compliance summary.
summary = {key: len([entry for entry in data if entry['status'] == '[1]']) for key in categories}The status values are case-sensitive and usually lowercase like 'compliant'.
Fill both blanks to create a dictionary of non-compliant devices and their error counts.
non_compliant = {device['[1]']: device['[2]'] for device in devices if device['status'] == 'non-compliant'}We want device IDs as keys and their error counts as values for non-compliant devices.
Fill all three blanks to generate a report dictionary with device names, error counts, and compliance status.
report = [1](device['[2]']: {'errors': device['[3]'], 'status': device['status']} for device in device_list)
We use dict() to create the dictionary, device names as keys, and error counts as values in the nested dict.