Created
October 1, 2023 11:24
-
-
Save rajrao/5fb8f599986d339422237b3dfa566ad9 to your computer and use it in GitHub Desktop.
Spiral using turle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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