Complete the code to set the red LED pin as an output.
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup([1], GPIO.OUT)
The red LED is connected to GPIO pin 17, so we set it as output using GPIO.setup(17, GPIO.OUT).
Complete the code to turn on the green LED.
GPIO.output([1], GPIO.HIGH)The green LED is connected to GPIO pin 22, so turning it on requires GPIO.output(22, GPIO.HIGH).
Fix the error in the code to turn off the blue LED.
GPIO.output([1], GPIO.LOW)The blue LED is connected to GPIO pin 18, so to turn it off use GPIO.output(18, GPIO.LOW).
Fill both blanks to create a dictionary mapping colors to their GPIO pins.
led_pins = [1]: 17, [2]: 22, 'blue': 18}
The dictionary keys for the red and green LEDs are 'red' and 'green' respectively, matching their GPIO pins.
Fill both blanks to create a dictionary comprehension that maps colors to their pin states when turned on.
led_states = [2]: GPIO.HIGH for [2], {{BLANK_4}} in led_pins.items()
The dictionary comprehension starts with '{', iterates over color and pin in led_pins.items(), and sets each color's state to GPIO.HIGH.