Complete the code to import the GPIO library.
import [1]
The RPi.GPIO library is used to control the Raspberry Pi GPIO pins.
Complete the code to set the GPIO mode to BCM numbering.
GPIO.setmode([1])GPIO.BCM sets the pin numbering to Broadcom SOC channel numbers.
Fix the error in setting up the button pin as input with pull-up resistor.
GPIO.setup(18, [1], pull_up_down=GPIO.PUD_UP)
The button pin must be set as input (GPIO.IN) with pull-up resistor enabled.
Fill both blanks to toggle the LED state when the button is pressed.
if GPIO.input(18) == [1]: led_state = not [2]
The button is pressed when input is LOW (due to pull-up). We toggle the current LED state.
Fill all three blanks to set up the LED pin, initialize its state, and update it.
GPIO.setup([1], GPIO.OUT) led_state = [2] GPIO.output([3], led_state)
Pin 17 is used for LED output. Initial state is off (False). We output the state to pin 17.
