python program to draw the spiral using turtle

Python program to draw the square spiral from inside out side

import turtle #Inside_Out

wn = turtle.Screen()

wn.bgcolor("green")

skk = turtle.Turtle()

skk.color("red")

def sqrfunc(size):

        for i in range(4):

                skk.fd(size)

                skk.left(90)

                size = size + 5

sqrfunc(6)

sqrfunc(26)

sqrfunc(46)

sqrfunc(66)

sqrfunc(86)

sqrfunc(106)

sqrfunc(126)

sqrfunc(146)

Python program to draw the square spiral from out side to inside

import turtle   #Outside_In

wn = turtle.Screen()

wn.bgcolor("purple")

wn.title("Turtle")

skk = turtle.Turtle()

skk.color("light blue")

def sqrfunc(size):

    for i in range(4):

        skk.fd(size)

        skk.left(90)

        size = size-5

sqrfunc(146)

sqrfunc(126)

sqrfunc(106)

sqrfunc(86)

sqrfunc(66)

sqrfunc(46)

sqrfunc(26)

Posted on by