This past week we have been doing recursion exercises. I have to admit, they have been pretty fun, tracing the the function call in your head to figure out what will be produced. The clever thing about the recursions is that many of the recursive functions have itself as code in the function body. For example, def o(g):
........
return sum(x in o(f))
A very clever implementation indeed. I love that it is easy to look at and it is efficient. The practice of tracing is not hard either, since if the function does what it proposes to do, then the produce should be what is expected so there is nothing challenging.
No comments:
Post a Comment