I am looking at the Tower of Anne Hoy example. I do understand the literal meaning behind the code but I am still having trouble understanding how it would execute. First we move the first n-1 cheeses to a intermediate stool, then we move the last piece of cheese which is also the biggest cheese that we intended to move to the designation stool, and at last we move the cheeses on the intermediate stool to the designation. However, I have a few confusions. When n = 1, I think we would still have to move the cheese from the source stool to the designation stool, but in the else clause, we are simply printing that we made such action.
I find it very not helpful if I could not understand the execution since I would not know the output for each step.
Monday, November 4, 2013
Friday, November 1, 2013
Week 4 Material
The week discussed the assignment and recursion in depth. I find recursion a little bit confusing. I could understand the logic behind the recursion, however, I am often confused by how the recursion is executed, what the output of each step is going to be.
We have seen multiple recursion examples this week, I find the tree_burst example the most difficult to understand. I think what the function does is that it draws out the first branch of the tree and the branches of such branch and continues to the second branch. Nonetheless, I am still having trouble understanding the functionality of the turtle_list.
We have seen multiple recursion examples this week, I find the tree_burst example the most difficult to understand. I think what the function does is that it draws out the first branch of the tree and the branches of such branch and continues to the second branch. Nonetheless, I am still having trouble understanding the functionality of the turtle_list.
Week 3 Material
The main topics of the week are inheritance, class declaration, building up subclasses and raising exceptions.
we have learned how to assign a class as the subclass to another class and that we could add methods and attributes to specialize such subclass. A subclass could access the superclass method but the superclass method could also be override and extend.
In addition, when the object returned are not the result we expected, we should raise an exception. We could build the exception in a class and raise it when need. There are many existing exceptions such as ValueError, ZeroDivisionError. The inheritance of the exception class is also very important.
Subscribe to:
Posts (Atom)