title: How to asynchronously reduce a variable's value while allowing the user to interact with the program?
body: <p>I am making a game in which a player has three values; hunger, temperature, thirst. These three stats are meant to continuously decrease i.e, every <em>one</em> second, all three stats decrease by <em>one</em>. But the values shouldn't be displayed on the screen. Meanwhile, as the stats are decreasing, the user is supposed to be playing the game. The stats are only meant to be displayed when the user presses &quot;e&quot;. Here is my code and what I have tried:</p>
  <pre class="lang-py prettyprint-override"><code>import time
  
  hunger = 100
  thirst = 100
  temperature = 100
  print(&quot;You've woken up after a plane crash. What you do and where you go is up to you. Just watch out for the elements.&quot;)
  
  while True:
      time.sleep(1)
      hunger -= 1
      temperature -= 1
      thirst -= 1
      stat = input(&quot;Enter command: &quot;)
      if stat == &quot;e&quot;:
          print(&quot;Your hunger is:&quot;,hunger,&quot;Your thirst is&quot;,thirst, &quot;Your temperature is&quot;,temperature)
  </code></pre>