Advertisement
Arcot

ch5 ex2

Oct 20th, 2022
862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. import random
  2. from turtle import *
  3.  
  4. t=Turtle()
  5. colors = ["violet","indigo","blue","green","yellow","orange","red"]
  6.  
  7. distance=0
  8. while distance<5000:
  9.   #random value for length
  10.   a=random.randrange(40)
  11.   #random value for angle
  12.   b=random.randrange(360)
  13.  
  14.   t.color(colors[distance%7])
  15.   t.forward(a)
  16.   t.right(b)
  17.   distance+=a
  18.  
  19. done()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement