Sunday, February 2, 2014

Week 4

Hello there you fabulous pythonista! This week Danny Heap gave lectures about recursion. As stated by one of the week's readings, "Recursion means “defining something in terms of itself” usually at some smaller scale, perhaps multiple times, to achieve your objective." Back in the first few weeks of my 148 adventure, recursion made no sense. It's still tricky to this day, but I now understand in which context I would create a recursive function. A cool/helpful example of recursion that we observed in class is the nested_depth function, where it returns an int according to the depth of nested lists in a list. Ex: list = [1, [2, 3, [4], 5], 6, 7]. If say nested_depth(list), it will return 2.
Week 4's lab was pretty swaggie. It helped my partner and I to design classes and to create complex methods. Although it was pretty easy and we were going considerably fast, our TA wouldn't explain how to use inheritance. So we sat there and surfed the web to find an explanation, but we never found a solution. Thus I need to learn how to do that really soon before it pops up in an exercise/assignment.
At first glance, exercise 2 was scary. It was full of exceptions and I had no idea what to do, so I laid out what the final product would look like and called it a day. The next afternoon I looked at it and I was pleasantly surprised to find out that I did half of it right. With the help of readings I was able to prevail over it's threat and dominate the exercise. I might be blowing this out of proportion though, since it was fairly simple.

No comments:

Post a Comment