Draw Pentago in Python Using Turtle

Python Program to Draw Pentago 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):
    pentago.color(random.choice(colors))
    pentago.forward(i * 2)
    pentago.left(72)

pentago.up()
pentago.goto(-140, -20)
pentago.write("Pentago")
pentago.hideturtle()

turtle.done()

Output:

About The Author

Leave a Reply