Set timer on user input python

Viewed 16

I need to get user input, and if he does not give an answer (the user didnt type anything within 30 seconds, or typed something besides Y/N)i want to terminate the program.

ans = input('please enter Y/N')'

what i want to do is:

if timer >30:
terminate program`
0 Answers
Related