title: Python Turtle Race Restart Function
body: <p>I just got done with my first Turtle Race and still had one assignment left, a restart function. I just cant get it to work as i want. The goal is, an output of a question: Restart? y or n, and that'll restart the race() function. I am really in need of your guys' help.</p>
  <pre><code>from turtle import *
  from random import randint
  
  
  Andi = Turtle(&quot;turtle&quot;)
  Andi.color(&quot;red&quot;)
  Andi.shape(&quot;turtle&quot;)
  Andi.penup()
  Andi.goto(-300,200)
  Andi.pendown()
  
  Dom = Turtle(&quot;turtle&quot;)
  Dom.color(&quot;green&quot;)
  Dom.shape(&quot;turtle&quot;)
  Dom.penup()
  Dom.setpos(-300,180)
  Dom.pendown()
  
  Pete = Turtle(&quot;turtle&quot;)
  Pete.color(&quot;blue&quot;)
  Pete.shape(&quot;turtle&quot;)
  Pete.penup()
  Pete.setpos(-300,160)
  Pete.pendown()
  
  Emir = Turtle(&quot;turtle&quot;)
  Emir.color(&quot;yellow&quot;)
  Emir.shape(&quot;turtle&quot;)
  Emir.penup()
  Emir.setpos(-300,220)
  Emir.pendown()
  
  windowcolor=Screen()
  windowcolor.bgcolor(&quot;black&quot;)
  
  turtles = [Emir, Pete, Dom, Andi]
  def race():
      global turtles
      winner = False
      finishline = 300
  
      while not winner:
          for current_turtle in turtles:
              move = randint(0, 10)
              current_turtle.forward(move)
              xcor = current_turtle.xcor()
              if (xcor &gt; finishline):
                  winner = True
                  current_turtle.forward(0)
                  winner_color = current_turtle.color()
                  print('The winner is', winner_color[1])
  def restart():
      global turtles
      while race():
          turtle.clear()                
  race ()
  restart ()
  while True:
      while True:
          answer = str(input(&quot;Restart? (y/n): &quot;))
          if answer in (&quot;y&quot;, &quot;n&quot;):
              break
          print(&quot;Invalid awnser&quot;)
      if answer == &quot;y&quot;:
          race
      else:
          print(&quot;Shutting off&quot;)
          break
  
  windowcolor.mainloop()
  
  while True:
      windowcolor.update()
  </code></pre>
  <p>What am I doing wrong, in my restart() function?</p>