Make a light turn off one second after I let go of the button

J-M-L:
you need a small state machine with one variable to remember the steps you went through

sorry I am a beginner how can I do this