title: How do I stop characters from attacking after they die?
body: <p>I'm working on a python text-based adventure and I can't figure out how to stop a character from doing damage once they die. The program works fine when I run it, but even after a character dies, they can still attack the other characters. I've looked on google but I can't find any relevant info</p>
  <p>Here's a snippet of my code:</p>
  <pre><code>from random import randint
  from random import choice
  
  class Warrior():
      def __init__(self,name):
          self.name = name
          self.health = 130
          self.damage = 20
          self.stamina = 100
      def takeDamage(self,amt):
          self.health -= amt
      def fist(self,who):
          who.takeDamage(self.damage)
      def sword(self,amt2):
          if self.stamina &gt; 25:
              chance = randint(0, 100)
              if chance &gt; 80:
                  self.health -= 50
                  self.stamina -= 25
                  print(self.name, &quot;performed a critical attack! &quot;)
              else:
                  self.health -= 30
                  self.stamina -= 15
          else:
              print(self.name, &quot;is too tired&quot;)
          if self.health &lt;= 0:
              print(self.name, &quot;died. &quot;)
              self.health = 0
          self.stamina += 10
          if self.health == 0:
              pass
  
  p1 = Warrior(&quot;Bob&quot;)
  p2 = Archer(&quot;Jim&quot;)
  p3 = Mage(&quot;Tom&quot;)
  p4 = Priest(&quot;Sam&quot;)
  
  print(p1.name, p1.health)
  print(p2.name, p2.health)
  print(p3.name, p3.health)
  print(p4.name, p4.health)
  
  print(p1.name,&quot;bonked&quot;,p2.name,&quot;with a rock&quot;)
  p1.sword(p2)
  print(p2.name,&quot;shot&quot;,p3.name,&quot;with a bow&quot;)
  p2.bow(p3)
  print(p3.name,&quot;fried&quot;,p4.name,&quot;with a stick&quot;)
  p3.staff(p4)
  print(p4.name,&quot;healed themselves&quot;)
  p4.heal(p4)
  </code></pre>