Sunday, 2 February 2014

Week 4: More Recursion

This week in CSC148 the topic of recursion was present again. The focus was mainly on tracing recursive functions through various examples testing the recursive depth. This was primarily carried out by using a function which returns the nested depth of nested lists. In layman's terms every time the function reached a list within the original list while looping through the items in the list it would call the function once again to carry out the function body on the items in the list, unless there was another list within the list, then it would call the function on the list again, and so on.

The tree burst function, which took turtle's and drew them, sent them in different directions, and then repeated that as many time as you specified, was a very fun and visual example of recursion that I very much enjoyed this week.

In lab we also explored class inheritance once again, which I think I have a firm handle on nowadays, although the super() method is still a little bit confusing to me. We also implemented unittest to test our classes, which is a much more thorough testing than the doctest function.

Exercise 2 was due this week, and it focused primarily on writing Exception classes and try/except clauses. By the time I finished I finally understood basic try/except classes, which I had problems with earlier in the semester and in CSC108.

Until Next Week,
Maxim Isakov