Skip to content

Instantly share code, notes, and snippets.

@rajrao
Created October 1, 2023 11:24
Show Gist options
  • Save rajrao/5fb8f599986d339422237b3dfa566ad9 to your computer and use it in GitHub Desktop.
Save rajrao/5fb8f599986d339422237b3dfa566ad9 to your computer and use it in GitHub Desktop.
Spiral using turle
# from https://twitter.com/clcoding/status/1708436006154785209?t=WNPxLM7Ox33QEVxUfRH-5w&s=19
import random
import turtle
colors = ['red', 'cyan', 'pink', 'yellow', 'green', 'orange']
t = turtle.Turtle()
t.speed(10)
turtle.bgcolor("black")
length=100
angle=50
size=5
for i in range(length):
color=random.choice(colors)
t.pencolor(color)
t.fillcolor (color)
t.penup()
t.forward(i+50)
t.pendown()
t.left(angle)
t.begin_fill()
t.circle(size)
t.end_fill()
turtle.exitonclick()
turtle.bgcolor("black")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment