I am trying to figure out a way to draw this:
but somehow I cant do this. I realize that the image is the same it's just 4 times in the right place. Here is the code that I have so far, can somebody help me achieve this ???
import turtle
def draw_fractal(t, length, depth):
if depth:
for _ in range(4):
t.forward(length)
t.right(90)
t.penup()
t.forward(length / 2)
t.right(90)
t.forward(length / 2)
t.left(90)
t.pendown()
# Draws smaller squares
for _ in range(4):
draw_fractal(t, length / 2, depth - 1)
if _ < 3:
t.penup()
t.forward(length)
t.right(90)
t.pendown()
t.penup()
t.left(90)
t.forward(length / 2)
t.right(90)
t.forward(length / 2)
t.pendown()
def main():
window = turtle.Screen()
window.bgcolor("white")
t = turtle.Turtle()
t.speed(0)
draw_fractal(t, 200, 3)
window.mainloop()
main()

