Python Waiting for a Button press and execute accordingly : from gpiozero import Button, LED 
from time import time, sleep 
from random import randint

led = LED(17) btn = Button(27)

while True:

    btn.wait_for_release()
    start = time()
    led.on()
    btn.wait_for_press()
    end = time()
    led.off()


print(end-start, 'seconds')

Hi I have got this working so far. 
Does any body know how to upgrade this to wait for the button press for a specific time( eg;5 mins)and if not pressed program executes another function. if pressed before 5 mins program stops