Advertisement
JkSoftware

Day 18 - Spirograph

Nov 30th, 2021
851
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. import turtle as t
  2. import random
  3.  
  4. tim = t.Turtle()
  5. t.colormode(255)
  6.  
  7.  
  8. def random_color():
  9.     r = random.randint(0, 255)
  10.     g = random.randint(0, 255)
  11.     b = random.randint(0, 255)
  12.     color = (r, g, b)
  13.     return color
  14.  
  15.  
  16. ########### Challenge 5 - Spirograph ########
  17.  
  18. def draw_spirograph(size_of_gap):
  19.     for _ in range(int(360 / size_of_gap)):
  20.         tim.color(random_color())
  21.         tim.circle(100)
  22.         tim.setheading(tim.heading() + size_of_gap)
  23.  
  24.  
  25. draw_spirograph(5)
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement