Oct-23-2019, 08:55 PM
As another use of a timer, I'm trying to do something like this:
Problem is the program stops and waits until input is submitted (when I did enter 12, I saw a running tab of elapsed time until four seconds... pretty cool!).
Is there a way to query continuously whether input has been submitted? If it hasn't then I would have it check time to see if four seconds have passed.
import time start = time.time() y = input("What is 4 * 3?") end = time.time() while (end-start) < 4: if y=="12": end = time.time() print("it took", (end-start), "seconds") else: quit() start = time.time() z = input("What is 6 * 6?")That is, wait until four seconds have elapsed before moving on if not input has been submitted.
Problem is the program stops and waits until input is submitted (when I did enter 12, I saw a running tab of elapsed time until four seconds... pretty cool!).
Is there a way to query continuously whether input has been submitted? If it hasn't then I would have it check time to see if four seconds have passed.