I want to make it so that after a certain time (depending on the difficulty that the user has chosen) the program continues with the code and the user can no longer enter anything.
This is what I have so far:
t = Timer(
getTime(),
print,
("Calculating...",)
)
t.start()
answer = input()
t.cancel()
This is the getTime function:
def getTime():
if difficulty == "easy":
time = 1
elif difficulty == "intermediate":
time = 0.75
elif difficulty == "hard":
time = 0.5
return time
What happens currently is that the thread ends and prints out "Calculating..." but the user is still allowed to input.
Thank you.