In python, is it possible to run code or perform an action while the script is sleeping like time.sleep()
? What I want to do is print a message and gather input from the user only until 10 seconds after the message has been printed. I initially though I could do
print "You have ten seconds to answer the question."
print "The question"
time.sleep(10) and input() simultaneously
print "You are out of time"
Is this possible? If not, is there any way to accomplish the same thing?