I want my turtles to go after the countdown finishes, but I cant figure out a way to do it. There are other issues, but i want to fix this first. I've tried time.sleep, and other stuff. I'm fairly new, so i'm not sure what do to. this is for a class as well, and I'm not finding good answers. here is the code
from turtle import Screen, Turtle
from random import choice
import time
FONT = ('Arial', 36, 'bold')
def race():
while turtle_1.xcor() < 200 or 200 > turtle_2.xcor():
choice([turtle_1, turtle_2]).forward(10)
def countdown(seconds=3):
if countdown() < 3:
turtle_1.pendown()
turtle_2.pendown()
turtle_1.forward(400)
turtle_2.forward(400)
if seconds < 1:
screen.ontimer(race)
else:
pen.write(seconds, align='center', font=FONT)
screen.ontimer(lambda: countdown(seconds - 1), 1000)
screen = Screen()
screen.bgcolor('green')
marker = Turtle()
marker.hideturtle()
marker.speed('fastest')
marker.color('white')
marker.width(5)
marker.penup()
marker.goto(200, 300)
marker.pendown()
marker.right(90)
marker.forward(600)
pen = Turtle()
pen.hideturtle()
turtle_1 = Turtle()
turtle_1.shape('turtle')
turtle_1.color('red')
turtle_1.penup()
turtle_1.goto(-400, 200)
turtle_2 = turtle_1.clone()
turtle_1.color('blue')
turtle_2.goto(-400, -200)
countdown()