[Tutor] recursion

Danny Yoo danny.yoo at gmail.com
Sat Feb 6 18:02:51 EST 2016


On Feb 5, 2016 12:07 AM, "noopy via Tutor" <tutor at python.org> wrote:
>
> Hi,
>
> I just cannot get my head around the following code, maybe someone could
explain it to me.
>
> def permutations(items):

When trying to understand a function (or in this case, a generator),
knowing the types of input and output can be helpful.  Also, knowing some
sample outputs for small inputs is also important.

Without even looking at the implementation, can you say in words what this
function is intended to do? What's the type of the input?  What's the type
of the output? And can you give a few concrete examples of what you'd like
it to do on "small" inputs?

(Trying to demonstrate a general problem strategy that works surprisingly
well, and that we actually use in practice.)


More information about the Tutor mailing list