Untitled

 avatar
unknown
plain_text
2 years ago
1.3 kB
3
Indexable
import turtle

# Set up the turtle
t = turtle.Turtle()
t.speed(0)

# Create the red triangle
t.begin_fill()
t.fillcolor("red")
t.pencolor("red")
for i in range(3):
    t.forward(200)
    t.left(120)
t.end_fill()

# Create the white triangle
t.up()
t.goto(0, 0)
t.down()
t.begin_fill()
t.fillcolor("white")
t.pencolor("white")
t.left(60)
for i in range(3):
    t.forward(200)
    t.left(120)
t.end_fill()

# Create the blue triangle
t.up()
t.goto(0, 0)
t.down()
t.begin_fill()
t.fillcolor("blue")
t.pencolor("blue")
t.left(120)
for i in range(3):
    t.forward(200)
    t.left(120)
t.end_fill()

# create the green band
t.up()
t.goto(-100, -50)
t.down()
t.begin_fill()
t.fillcolor("green")
t.pencolor("green")
t.right(90)
t.forward(200)
t.right(90)
t.forward(50)
t.right(90)
t.forward(200)
t.right(90)
t.forward(50)
t.end_fill()

# create the yellow band
t.up()
t.goto(-100, -100)
t.down()
t.begin_fill()
t.fillcolor("yellow")
t.pencolor("yellow")
t.forward(200)
t.right(90)
t.forward(50)
t.right(90)
t.forward(200)
t.right(90)
t.forward(50)
t.end_fill()

# create the black band
t.up()
t.goto(-100, -150)
t.down()
t.begin_fill()
t.fillcolor("black")
t.pencolor("black")
t.forward(200)
t.right(90)
t.forward(50)
t.right(90)
t.forward(200)
t.right(90)
t.forward(50)
t.end_fill()

# Hide the turtle and exit
t.hideturtle()
turtle.exitonclick()
Editor is loading...