title: Why don't variables upload in a loop?
body: <p>I want to make a program that tracks how many apples apples I have and takes an apple away when I eat one.</p>
  
  <pre><code>apples=3
  
  while apples&gt;0:
      try: 
          print("You have {} a left".format(apples))
  
          Action=input('Action:')
          if action == "eat":
              apples=apples-1
          else:
              print("invalid")
      except:
          pass
  </code></pre>
  
  <p>However this code doesn't update apples when I write eat as user input.</p>
  
  <blockquote>
    <p>You have 3 apples left<br>
    Action:eat<br>
    You have 3 apples left<br>
    Action:eat<br>
    You have 3 apples left<br>
    Action:eat<br>
    You have 3 apples left<br>
    Action:eat<br>
    You have 3 apples left</p>
  </blockquote>