figure - function execution environment functions may obtain input and produce output in variety of waysthough functions are usually easier to understand and maintain if you use arguments for input and return statements and anticipated mutable argument changes for output in python onlyoutputs may also take the form of declared nonlocal names that exist in an enclosing function scope recursive functions we mentioned recursion in relation to comparisons of core types in while discussing scope rules near the start of we also briefly noted that python supports recursive functions--functions that call themselves either directly or indirectly in order to loop in this sectionwe'll explore what this looks like in our functionscode recursion is somewhat advanced topicand it' relatively rare to see in pythonpartly because python' procedural statements include simpler looping structures stillit' useful technique to know aboutas it allows programs to traverse structures that have arbitrary and unpredictable shapes and depths--planning travel routesanalyzing languageand crawling links on the webfor example recursion is even an alternative to simple loops and iterationsthough not necessarily the simplest or most efficient one summation with recursion let' look at some examples to sum list (or other sequenceof numberswe can either use the built-in sum function or write more custom version of our own here' what custom summing function might look like when coded with recursiondef mysum( )if not lreturn elsereturn [ mysum( [ :]call myself recursively recursive functions