title: How can I repeat a game over and over, for example guess game
body: <p>I have seen many ideas about how to reply a game but none of them worked for me.</p>
  <pre><code>import random
  list_number=[&quot;&quot;,&quot;&quot;,&quot;o&quot;]
  random.shuffle(listing)
  def player_choice():
      player=&quot;&quot;
      while player not in [&quot;0&quot;,&quot;1&quot;,&quot;2&quot;]:
          player=input(&quot;Please select a number from 0 to 2 : &quot;)
      return int(player)
  player_choice()
  
  def player_guess(list_number,player_choice):
      play_again = &quot;y&quot;
      while play_again == &quot;y&quot;:
          if player_choice == list_number[0]:
              print(&quot;You did it&quot;)
          elif player_choice == list_number[1]:
              print(&quot;You did it&quot;)
          elif player_choice == list_number[2]:
              print(&quot;You did it&quot;)
          else:
              print(&quot;You got it wrong. Do you want to try again?&quot;)
          play_again=input(&quot;Do you want to play again? y/n &quot;)
          if play_again == &quot;n&quot;:
              break
       
  
  player_guess(listing,player_choice)
  </code></pre>
  <p>This is my code. I am new in this world of programming. I do not understand why it not keep repeating the game over and over even if I write &quot;y&quot; on &quot;play_again&quot;. I have tried many ideas but none of them worked.</p>