title: How to add an automatic restart after the game has ended into my tic tac toe program?
body: <p>so I've recently started learning how to program using Python and I tried to create a tic tac toe game with minimal video help to test my general knowledge, except I kind of hit a roadblock...I have everything set, but I am trying to add some code that will restart the program from scratch after the game has ended (victory or tie). How would I go about doing this?</p>
  <p>Here is my current code. Feel free to make some other suggestions as they would really help a beginner out like me.</p>
  <pre><code>board = [&quot;-&quot;, &quot;-&quot;, &quot;-&quot;,
           &quot;-&quot;, &quot;-&quot;, &quot;-&quot;,
           &quot;-&quot;, &quot;-&quot;, &quot;-&quot;]
  
  
  def playing_board():
      print(board[0] + &quot; | &quot; + board[1] + &quot; | &quot; + board[2])
      print(board[3] + &quot; | &quot; + board[4] + &quot; | &quot; + board[5])
      print(board[6] + &quot; | &quot; + board[7] + &quot; | &quot; + board[8])
  
  
  
  def game_time():
      position = &quot;X&quot;
      count = 0
      while True:
          playing_board()
          selection = int(input(position + &quot;, choose your position 1-9: &quot;)) - 1
          if (board[selection]) == &quot;-&quot;:
              board[selection] = position
              count += 1
              if count == 9:
                  print(&quot;Tie!&quot;)
          else:
              print(&quot;Sorry that position is already taken. Choose again&quot;)
              continue
          if board[0] == board[1] == board[2] == position or \
              board[0] == board[4] == board[8] == position or \
              board[3] == board[4] == board[5] == position or \
              board[6] == board[7] == board[8] == position or \
              board[6] == board[4] == board[2] == position or \
              board[0] == board[3] == board[6] == position or \
              board[1] == board[4] == board[7] == position or \
              board[2] == board[5] == board[8] == position:
              playing_board()
              print(position + &quot; wins!&quot;)
          if position == &quot;X&quot;:
              position = &quot;O&quot;
          else:
              position = &quot;X&quot;
          
  
  def new_game():
  
      while True:
          user_input = input(&quot;Would you like to play another game? (Y/N): &quot;)
          if user_input.upper() == &quot;Y&quot;:
              continue
          elif user_input.upper() == &quot;N&quot;:
              print(&quot;Okay, cya!&quot;)
              quit()
          else:
              print(&quot;I didn't quit get that...&quot;)
  
  
  
  game_time()
  </code></pre>