Complete the code to run an Electrical Rules Check (ERC) on the PCB design.
erc_results = pcb_design.run_[1]()The correct method to run an Electrical Rules Check is ERC. DRC is for Design Rules Check, which is different.
Complete the code to filter ERC errors by severity level.
critical_errors = [e for e in erc_results if e.[1] == 'Critical']
The severity attribute indicates the seriousness of an ERC error, such as 'Critical'.
Fix the error in the code that summarizes ERC errors by type.
error_summary = [1](erc_results, key=lambda e: e.type)The groupby function groups ERC errors by their type for summary.
Fill both blanks to check if any ERC error is unresolved and critical.
has_critical_unresolved = any(e.[1] == 'Critical' and e.[2] == False for e in erc_results)
We check severity for 'Critical' and resolved to be False to find unresolved critical errors.
Fill all three blanks to generate a report of ERC errors grouped by type and count.
report = [1]([2]([3], key=lambda e: e.type), key=lambda g: g[0]) error_counts = {group: len(list(items)) for group, items in report} print(error_counts)
First, group errors by type using groupby on erc_results, then sort the groups with sorted for a neat report.
