What I would like to be able to do is ask a user a question using input. For example:
print('some scenario')
prompt = input("You have 10 seconds to choose the correct answer...\n")
and then if the time elapses print something like
print('Sorry, times up.')
Any help pointing me in the right direction would be greatly appreciated.
Interesting problem, this seems to work:
If it is acceptable to block the main thread when user haven't provided an answer:
Otherwise, you could use @Alex Martelli's answer (modified for Python 3) on Windows (not tested):
Usage:
On Unix you could try:
Or: