Turtle race using python

import turtle

from random import *

from turtle import *

penup()

goto(-140,140)

for sp in range(15): 

  write(sp)

  right(90)

  forward(10)

  pendown()

  forward(150)

  penup()

  backward(160)

  left(90)

  forward(20)

x = Turtle() 

x.color('green') 

x.shape('turtle') 

x.penup() 

x.goto(-160,100) 

x.pendown() 

y = Turtle() 

y.color('red') 

y.shape('turtle') 

y.penup() 

y.goto(-160,80) 

y.pendown() 

turtlee = Turtle() 

turtlee.color('blue') 

turtlee.shape('turtle') 

turtlee.penup() 

turtlee.goto(-160,60) 

turtlee.pendown() 

for turn in range(100): 

  x.forward(randint(1,5)) 

  y.forward(randint(1,5)) 

  turtlee.forward(randint(1,5)) 

turtle.done()

No comments: