I am trying to write a really basic program based on a trivia game. i have two problems. the first, is that i do not know how to assign a variable whose value will increase with time. my second problem is that i need to allow the user to enter an input before time runs out. the problem is that: suppose i successfully start a stopwatch once the question is asked(and assign the stopwatch value to a variable). if i write 'if stopwatchTime < maxTimeAllowed: userAns = input()' the statement will be true, and the program will take an input. but, after i call the input function, the rest of the program suspends until an input is given. i need a way for the program to be simultaneously waiting for an input AND checking to see if the time limit has passed, so that after a certain amount of time, the program will not accept an input from the user.
time and input
Collapse
X
Comment