JkSoftware

Day 18 - Circles

Nov 28th, 2021
824
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import turtle as t
  2. import random
  3. from turtle import Screen
  4.  
  5. timmy = t.Turtle()
  6. t.colormode(255)
  7.  
  8.  
  9. def random_color():
  10.     r = random.randint(0, 255)
  11.     g = random.randint(0, 255)
  12.     b = random.randint(0, 255)
  13.     color = (r, g, b)
  14.     return color
  15.  
  16. def circles(width_):
  17.     for i in range(5):
  18.         heading = 360 / width_
  19.         timmy.color(random_color())
  20.         timmy.circle(100)
  21.         timmy.setheading(timmy.heading() + heading)
  22.  
  23. circles(5)
  24.  
RAW Paste Data