title: How would I make it so after a certain time the user is no longer allowed to input something?
body: <p>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.</p>
  <p>This is what I have so far:</p>
  <pre><code>t = Timer(
       getTime(),
       print,
       (&quot;Calculating...&quot;,)
  )
  t.start()
  answer = input()
  t.cancel()
  </code></pre>
  <p>This is the getTime function:</p>
  <pre><code>def getTime():
      if difficulty == &quot;easy&quot;:
          time = 1
      elif difficulty == &quot;intermediate&quot;:
          time = 0.75
      elif difficulty == &quot;hard&quot;:
          time = 0.5
      return time
  </code></pre>
  <p>What happens currently is that the thread ends and prints out &quot;Calculating...&quot; but the user is still allowed to input.</p>
  <p>Thank you.</p>