Monday, February 3, 2014

Week4

In week 4 lectures, we looked at assignment 1 together. And I haven't read through the assignment handout yet, which I will read really soon. During the lecture, we talked about the nesting depth of list with "return (1 + max([nested_depth(x) for x in L] + 0) if is instance(L, list) else 0). This is probably one of my first recursive functions I have ever seen. It is very interesting to see how the recursive function can combine if and else into one or two lines of functions. It first checks whether the given variable is a list or not, and then decide what to do with the function call.We also saw tree_burst.py. The function kept calling itself using recursive codes, and generated literally tree burst which was pretty impressive.

I have found the lab and exercise 2 to be fairly easy to follow and did not take that much time for me to figure things out.

No comments:

Post a Comment