title: How would I be able to test the below code so that I can see how the tiebreaker would function?
body: <p>As you can see, I'm a complete beginner at Python so any help would be appreciated. My issue is that I'm trying to test the code for all the scenarios, but I'm unable to test the tiebreaker. Sure, I could just insert <code>Player1Score = Player2Score</code> (which I've hash tagged to show the location) but that would just send the program into an endless loop, which defeats the purpose of the tiebreaker. So is there any way that I can I can have the program only go through the tiebreaker segment once and then let a single player win?</p>
  <p>(I apologize if I've made any errors with my question, I'm new to stackoverflow as well)</p>
  <pre class="lang-py prettyprint-override"><code>
  import random
  
  def DiceGame():
    Count = 0
    Player1Score = 0
    Player2Score = 0
    while Count &lt;= 4:
      Count += 1
      print (&quot;\n It is Round&quot;,Count, &quot;\n&quot;)
      print (&quot;It is Player 1's turn.&quot;)
      x = input(&quot;Press [Enter] to roll.&quot;)
      Score = Rolls()
      Player1Score += Score
      print (&quot;Player 1, your score so far is&quot;,Player1Score)
      print (&quot;It is Player 2's turn.&quot;)
      x = input(&quot;Press [Enter] to roll.&quot;)
      Score = Rolls()
      Player2Score += Score
      print (&quot;Player 2, your score so far is&quot;,Player2Score)
    #Player1Score = Player2Score
    if Player1Score == Player2Score:
      print (&quot;It is a tie!&quot;)
      print (&quot;There will be a final tiebreaker.&quot;)
      Count -= 1
      DiceGame()
    elif Player1Score &gt;= Player2Score:
      print (&quot;Player 1 wins!&quot;)
    elif Player1Score &lt;= Player2Score:
      print (&quot;Player 2 wins!&quot;)
  
  
  def Rolls():
    Roll1 = random.randint(1,6)
    Roll2 = random.randint(1,6)
    print (&quot;You got a&quot;,Roll1)
    print (&quot;You got a&quot;,Roll2)
    Score1 = Roll1 + Roll2
    if Score1 == 2 or Score1 == 4 or Score1 == 6 or Score1 == 8 or Score1 == 10 or Score1 == 12:
      print (&quot;Your total is even so you get an extra 10 pts.&quot;)
      Score2 = Score1 + 10
      print (&quot;Your score for this round is&quot; ,Score2)
    elif Score1 == 3 or Score1 == 5 or Score1 == 7 or Score1 == 9 or Score1 == 11:
      print (&quot;Your total is odd so you lose 5 pts.&quot;)
      Score2 = Score1 - 5
      if Score2 &lt;= 0:
        print (&quot;Your score has gone below 0pts. It will therefore be reset to 0pts&quot;)
        Score2 = 0
      print (&quot;Your score for this round is&quot; ,Score2)
    
    return Score2
  
  DiceGame()
  </code></pre>