I am attempting to create a basic graphic in Turtle using loops to create a series of
4 yellow boxes that are 160 units on a side w/
4 smaller blue boxes half that size superimposed on the yellow,
4 smaller green boxes half the size of the blue over the blue,
4 white and 4 red in the same fashion.
I am having trouble creating loops to do so. Here is my code thus far, and thank you!:
from turtle import Turtle
t = Turtle()
for i in range(4):
t.begin_fill ()
t.fillcolor("yellow")
t.forward(160)
t.left(90)
t.forward(160)
t.left(90)
t.forward(160)
t.left(90)
t.forward(160)
t.end_fill()
t.hideturtle( )
for i in range(4):
t.begin_fill ()
t.fillcolor("blue")
t.forward(120)
t.left(90)
t.forward(120)
t.left(90)
t.forward(120)
t.left(90)
t.forward(120)
t.end_fill()
t.hideturtle( )
for i in range(4):
t.begin_fill ()
t.fillcolor("green")
t.forward(80)
t.left(90)
t.forward(80)
t.left(90)
t.forward(80)
t.left(90)
t.forward(80)
t.end_fill()
t.hideturtle( )
for i in range(4):
t.begin_fill ()
t.fillcolor("white")
t.forward(40)
t.left(90)
t.forward(40)
t.left(90)
t.forward(40)
t.left(90)
t.forward(40)
t.end_fill()
t.hideturtle( )
for i in range(4):
t.begin_fill ()
t.fillcolor("red")
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.end_fill()
t.hideturtle( )