Understanding how is a function evaluated using recursion
Josh English
Joshua.R.English at gmail.com
Wed Sep 25 19:59:25 EDT 2013
On Wednesday, September 25, 2013 4:24:22 PM UTC-7, Arturo B wrote:
> Hi, I'm doing Python exercises and I need to write a function to flat nested lists
> So I know what recursion is, but I don't know how is
>
> flatten(i)
>
> evaluated, what value does it returns?
>
In this case, flatten always returns a list. When it hits the recursion, it calls itself to get another list, that it uses to extend the current list.
Josh
More information about the Python-list
mailing list