title: While loop not ending when variable is equal to zero
body: <p>I'm making a game where the player deals damage to the enemy to end a battle (like most games).
  However, I encountered a problem.</p>
  <pre><code>while battle != 0:
      playerturn()
      time.sleep(1)
      allyturn()
      time.sleep(1)
      enemyturn()
      time.sleep(1)
  
  print(&quot;Battle complete.&quot;)
  </code></pre>
  <p>The while loop above loops without ending, so the &quot;Battle Complete&quot; never appears.</p>
  <p>In <code>playerturn()</code> and <code>allyturn()</code>, the enemy's HP is reduced. If the enemy's HP is at or below 0 in <code>enemyturn()</code>, <code>battle = 0</code>.
  This is in <code>enemyturn()</code>...</p>
  <pre><code>if eHP &lt;= 0:
      #eHP stands for enemy HP
      print(&quot;Bandit Robber is defeated.&quot;)
      battle = 0
  </code></pre>
  <p>I made sure to import time before, and that's not the problem anyways.
  Any help would be appreciated.</p>
  <p>Here is an example code that is basically the same:</p>
  <pre><code>import random
  
  def testpart():
      battle = 0
  
  def test():
      battle = 1
      while battle != 0:
          print(&quot;This is testing.&quot;)
          testpart()
  
  test()
  </code></pre>