title: how do i interup input in processing in python
body: <p>I try to make a simple game, give a sum random number and input to answer it, I try to limit the time for input, but I can stop the input processing when timeout.</p>
  
  <pre><code>score=0
  from threading import Timer
  while score&lt;=3:
      import random
      a=random.randint(0,100)
      b=random.randint(0,100)
      sum=a+b
      d=str(sum)
      while True:
          print(a,"+",b,"=")
          timeout = 3
          t = Timer(timeout, print, ['Sorry, times up'])
          t.start()
          prompt = "you have %d s to input your answer\n" % timeout
          c = input(prompt)
          t.cancel()
  
            #i want to stop input c and make other code like 'do you want to play again'
          if c.isdigit():
              break
          else:
              print('invalid input')
          continue
      result=c
      if result==d:
          score=score+1
          print('your score',score)
      else:
          score=score-1
          print('your score',score)
  else:
      print('you win')
  </code></pre>