recursive functions recursion is one of the most fundamental concepts of computer science in pythonwe can implement recursive function simply by calling it within its own function body to stop recursive function turning into an infinite loopwe need at least one argument that tests for terminating case to end the recursion this is sometimes called the base case it should be pointed out that recursion is different from iteration although both involve repetitioniteration loops through sequence of operationswhereas recursion repeatedly calls function both need selection statement to end technicallyrecursion is special case of iteration known as tail iterationand it is usually always possible to convert an iterative function to recursive function and vice versa the interesting thing about recursive functions is that they are able to describe an infinite object within finite statement the following code should demonstrate the difference between recursion and iteration both these functions simply print out numbers between low and highthe first one using iteration and the second using recursionnoticeitertestthe iteration examplewe use while statement to test for the conditionthen call the print methodand finally increment the low value the recursive example tests for the conditionprintsthen calls itselfincrementing the low variable in its argument in generaliteration is more efficienthoweverrecursive functions are often easier to understand and write recursive functions are also useful for manipulating recursive data structures such as linked lists and treesas we will see generators and co-routines we can create functions that do not just return one resultbut rather an entire sequence of resultsby using the yield statement these functions are called generators python contains generator functionswhich are an easy way to create iterators and they are especially useful as replacement for unworkably long lists generator yields items rather than build lists for examplethe following code shows why we might choose to use generator as opposed to creating list