the example of using LED and button with GPIO RPI.
Sketch :
import gpiozero
import time
buttom = gpiozero.Button(17)
led = gpiozero.LED(4)
while True:
if buttom.is_pressed:
led.on()
time.sleep(1)
led.off()
time.sleep(1)
else:
led.on()
time.sleep(2)
led.off()
time.sleep(3)