If you are just learning about classes, then take a clue from this one…
from random import choice class Player: def __init__(self): self.dead = False def toggle(self): self.dead = not self.dead def shot(self): return choice([0, 1]) us = Player(), Player() you, me = us
while True: if you.dead and me.dead: break if you.shot(): you.toggle(); print ("You're hit!") if me.shot(): me.toggle(); print ("I'm hit!") print ('Bye!')
Run the loop lots of times.