maynul67

turtle: random pattern generator

Jul 28th, 2021
738
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import turtle
  2. import random
  3. colors = ['red', 'yellow','green','blue', 'purple', 'grey', 'white','orange','violet']
  4. t = turtle.Pen()
  5. t.width(1.5)
  6. turtle.bgcolor('black')
  7. for x in range(200):
  8.     col = random.randint(0,8)
  9.     t.pencolor(colors[col])
  10.     t.forward(x)
  11.     t.left(60)
  12.    
RAW Paste Data