title: How to reduce the amount of lines needed for this logic?
body: <p>I have a simple Python game where two players deal some damage to each other in turns until one player has 0 or less than 0 HP. I don't like how much I've repeated myself but I'm unsure how to fix this. I thought about using a list of players but then I'm unsure how to index the next player when it's their turn, without running into the list index out of range error.</p>
  <p><strong>If this kind of question is not allowed please let me know and I will remove it.</strong></p>
  <p>Below is my game logic to determine when a player has won. I may not have pasted in the exact code I have but it runs how it's expected locally.</p>
  <pre><code>def check_win_state(current_player):
    if current_player.get_player_health() &gt; 0:
      return True
    elif current_player.get_player_health() &lt;= 0:
      return False
  
  
  def main():
    player1 = player.Player(&quot;Me&quot;)
    player2 = player.Player(&quot;You&quot;)
  
    while True:
      if check_win_state(player1):
        take_turn(player1, player2)
      else:
        print(f&quot;\n{player2.get_player_name()} ({player2.get_player_health()} HP) wins! {player1.get_player_name()} has {player1.get_player_health()} HP left.\n&quot;)
        break
          
      if check_win_state(player2):
        take_turn(player2, player1)
      else:
        print(f&quot;\n{player1.get_player_name()} ({player1.get_player_health()} HP) wins! {player2.get_player_name()} has {player2.get_player_health()} HP left.\n&quot;)
        break
  </code></pre>