Skip to main content

Four Square pattern using Python program

Four Square Pattern


import turtle
turObj = turtle.Turtle()
turObj.getscreen().bgcolor("#555555")
turObj.speed(5000)
def star(turtle, size):
    if size <=5:
        return
    else:
        for i in range(4):
            turObj.color("#FFFFFF")
            turtle.forward(size)
            star(turtle,size/2)
            turtle.left(270)

star(turObj,100)       


turtle.done()


Output:



Comments