Advertisement
Nizarus

Turtle_race best_icouldmakesofar

Jul 21st, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. from turtle import Turtle
  2. def create_turtle(color, position):
  3.   x=Turtle()
  4.   x.color(color)
  5.   x.shape("turtle")
  6.   x.penup()
  7.   x.goto(position[0],position[1])
  8.   x.pendown()
  9.   return x
  10. def movement(turtle_list):
  11.   from random import randint
  12.   for movement in range(100):
  13.     turtle_list[0].forward(randint(1,5))
  14.     turtle_list[1].forward(randint(1,5))
  15.     turtle_list[2].forward(randint(1,5))
  16.     turtle_list[3].forward(randint(1,5))
  17.    
  18.  
  19. lina=create_turtle("green", (-160, 100))
  20. maxi=create_turtle("purple",(-160, 60))
  21. laura=create_turtle("yellow",(-160, 40))
  22. zina=create_turtle("red",(-160,10))
  23. movement([lina,maxi,laura,zina])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement