Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import Turtle, Screen
- import turtle as t
- import random
- t.colormode(255)
- timmy = Turtle()
- timmy.shape("arrow")
- timmy.pensize(15)
- directions = [0, 90, 180, 270]
- def random_color():
- r = random.randint(0, 255)
- g = random.randint(0, 255)
- b = random.randint(0, 255)
- random_color = (r, g, b)
- return random_color
- def draw_shape():
- timmy.color(random_color())
- timmy.forward(30)
- timmy.setheading(random.choice(directions))
- for i in range(500):
- draw_shape()
- screen = Screen()
- screen.exitonclick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement