Complete the code to set up a GPIO pin as output.
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup([1], GPIO.OUT)
GPIO pins are identified by numbers like 18. This code sets pin 18 as an output pin.
Complete the code to turn on an LED connected to a GPIO pin.
GPIO.output(18, [1])
Setting the pin to GPIO.HIGH turns the LED on by sending voltage.
Fix the error in the code to clean up GPIO settings.
GPIO.[1]()GPIO.cleanup() resets the GPIO pins to a safe state after use.
Fill both blanks to create a dictionary of pin states for pins 17 and 27.
pin_states = {17: GPIO.[1], 27: GPIO.[2]This dictionary shows pin 17 is HIGH (on) and pin 27 is LOW (off).
Fill all three blanks to create a dictionary comprehension that maps pin numbers to their output states if the state is HIGH.
active_pins = {pin: state for pin, state in pin_states.items() if state == GPIO.[1] and pin != [2] and pin != [3]This code filters pins that are HIGH and excludes pins 17 and 27.
