+ 2

Input timeout

I have been given a project to code for a game called "GUESS WHAT" and I am looking for an easy approach to write a code which sets a given time interval to accept the input from the user and if the user fails to give an input then the next question arises with the same process to be carried out... For example- I SET A TIMER FOR 10 SECONDS. IF THE USER FAILS TO ENTER ANY INPUT...NEXT QUESTION ARISES WHICH PROMPTS FOR ANOTHER INPUT WITH THE TIMER SETTING BACK AGAIN TO 10 SECONDS. I would be grateful to receive your response....

6th Oct 2019, 1:07 PM
Utkarsh Kumar
Utkarsh Kumar - avatar
4 Réponses
+ 1
Interesting question. I have found this: https://stackoverflow.com/questions/15528939/JUMP_LINK__&&__python__&&__JUMP_LINK-3-timed-input and the highest upboted answer (not the accepted one) looks like a neat solution.
6th Oct 2019, 4:05 PM
Russ
Russ - avatar
+ 1
Try it in another compiler, because sololearn runs program in less than 5 secs If your code takes more than 5 secs than you will get: time limit exceeded error
6th Oct 2019, 5:14 PM
Sousou
Sousou - avatar
0
Hi
13th Oct 2019, 5:49 PM
Sultan Elubaev