Draw Astroid in Python Using Turtle

Python Program to Draw Astroid in Python Using Turtle

import turtle
import random

wn = turtle.Screen()
wn.bgcolor("black")
astroid = turtle.Turtle()
astroid.speed(0)
triad = turtle.Turtle()
triad.speed(0)
triad.up()
triad.goto(-120, 120)
triad.down()
squad = turtle.Turtle()
squad.speed(0)
squad.up()
squad.goto(120, 120)
squad.down()
pentago = turtle.Turtle()
pentago.speed(0)
pentago.up()
pentago.goto(-120, -120)
pentago.down()
octago = turtle.Turtle()
octago.speed(0)
octago.up()
octago.goto(120, -120)
octago.down()
colors = ["red", "gold", "blue", "green", "white", "cyan", "pink"]
 
for i in range(50):
    astroid.color(random.choice(colors))
    astroid.forward(i * 3)
    astroid.left(144)
 

astroid.up()
astroid.goto(0, 60)

Output:

About The Author

Leave a Reply