figure call stack generated from tostr( , if you keep this idea of the stack in your headyou will find it much easier to write proper recursive function visualising recursion in the previous section we looked at some problems that were easy to solve using recursionhoweverit can still be difficult to find mental model or way of visualizing what is happening in recursive function this can make recursion difficult for people to grasp in this section we will look at couple of examples of using recursion to draw some interesting pictures as you watch these pictures take shape you will get some new insight into the recursive process that may be helpful in cementing your understanding of recursion the tool we will use for our illustrations is python' turtle graphics module called turtle the turtle module is standard with all versions of python and is very easy to use the metaphor is quite simple you can create turtle and the turtle can move forwardbackwardturn leftturn rightetc the turtle can have its tail up or down when the turtle' tail is down and the turtle moves it draws line as it moves to increase the artistic value of the turtle you can change the width of the tail as well as the color of the ink the tail is dipped in here is simple example to illustrate some turtle graphics basics we will use the turtle module to draw spiral recursively the code below shows how it is done after importing the turtle module we create turtle when the turtle is created it also creates window for itself to draw in next we define the drawspiral function the base case for this simple function is when the length of the line we want to drawas given by the len parameteris reduced to zero or less if the length of the line is longer than zero we instruct the turtle to go forward by len units and then turn right degrees the recursive step is when we call drawspiral again with reduced length at the end of the code below you will notice that we call the function my_win exitonclick()this is handy little method of the window that puts the turtle into wait mode until you click inside the windowafter which the program cleans up and exits visualising recursion