Complete the code to add a new component to the schematic.
schematic.add_component([1])The add_component function requires the component type to add it to the schematic. Here, resistor is the correct component to add.
Complete the code to connect two components with a wire.
schematic.connect([1], component_b)The connect function links two components. The first argument should be the first component, here component_a.
Fix the error in the code to select a component by its ID.
selected = schematic.select_component([1])The component ID should be passed as a string, so it must be enclosed in quotes like '1234'.
Fill both blanks to create a dictionary of component names and their positions.
positions = { [1]: schematic.get_position([2]) for [1] in components }We use the variable name to iterate over components and get each component's position by passing name to get_position.
Fill all three blanks to filter components by type and create a list of their IDs.
filtered_ids = [[1].id for [2] in schematic.components if [3] == 'resistor']
We iterate over component in schematic.components. To filter by type, we check component.type equals 'resistor'. The list collects component.id.
