Trying to get the program to close if an input isn't inputted in time.
from threading import Timer
import sys
loop = False
while(not loop):
timeout = 5
t = Timer(timeout, print, ['Sorry, times up'])
t.start()
prompt = input("Enter Y or No: \n").lower()
if prompt != None:
t.cancel()
if (prompt == "y") or (prompt == "n"):
print("Correct Answer")
loop = True
sys.exit()
Currently, once it prints Sorry, times up
the input & IF sections still run.