Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to export the BOM as a CSV file.
PCB Design
export_bom(filename=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the filename
Using a variable name instead of a string
✗ Incorrect
The filename must be a string with quotes, so "bom.csv" is correct.
2fill in blank
mediumComplete the code to include the quantity column in the BOM export.
PCB Design
export_bom(columns=["Part", [1], "Value"])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong column name like "Reference" instead of "Quantity"
Forgetting to put the column name in quotes
✗ Incorrect
The quantity column is named "Quantity" and should be included in the columns list.
3fill in blank
hardFix the error in the code to filter BOM items with quantity greater than 1.
PCB Design
filtered_bom = [item for item in bom if item["Quantity"] [1] 1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' or '<' which select wrong items
Using '==' which selects only quantity exactly 1
✗ Incorrect
To filter items with quantity greater than 1, use the '>' operator.
4fill in blank
hardFill both blanks to create a dictionary of part counts from the BOM list.
PCB Design
part_counts = {item[[1]]: item[[2]] for item in bom} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping keys and values
Using wrong column names like "Reference" or "Value"
✗ Incorrect
The dictionary keys are part names ("Part") and values are quantities ("Quantity").
5fill in blank
hardFill all three blanks to generate a filtered BOM with parts having quantity greater than 2 and export it.
PCB Design
filtered = [item for item in bom if item[[1]] [2] [3]] export_bom(data=filtered)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong column name in first blank
Using wrong operator or number in second and third blanks
✗ Incorrect
Filter by quantity greater than 2 using item["Quantity"] > 2.
