This week's assigned topic is to revisit an earlier SLOG post. I'll be revisiting my second post. In this post I discussed my problems with writing functions. In February, I frequently wrote my function body before the docstring, which went against the function design recipe. However, I have improved from then since I now can picture what a docstring might look like before I write the body.
I also mentioned how I found recursion to be a difficult concept. While this is still true now, I have a much better understanding of recursion after lots of practise with writing recursive functions. For example, I was often lost with how to write the body during many of the labs and I couldn't understand what to do until I saw the lab solutions. But today I was able to write the function grow for assignment three, although it took a few hours. My hope is to master this concept before the final exam.
Looking at this slogger's post, I know I'm not the only one who still has some trouble with recursion. I found it difficult, as did this slogger, to use recursion together with trees. For a long time I didn't know how to traverse through a tree using recursion and I also found it very difficult to recursively build a tree for assignment three. The examples in lecture made sense, but I wasn't keeping up with the lab exercises during the strike so I fell behind on the course work. Of course I only have myself to blame, for not keeping up with the work, but I have caught up on all the material as of now.
Don't worry, I find recursion a difficult concept too! It took me a while to figure out a way to create recursive code that wasn't using that list comprehension model from the lecture and lab examples. They key I learned was to unpack that code's structure so it doesn't have to rely on lists or any specific data set. I still think I have a long way to go to master recursion so don't feel alone!
ReplyDeleteIt also took me a while to learn how to unpack a list comprehension into a few lines of code. I agree with you that it's important for code to not rely on a particular data type. That was one of the biggest difficulties I faced when I used list comprehensions. Hopefully we can both master recursion before the exam!
Delete