This week, I completed the first assignment - I also started it this week which was a mistake, but it all worked out in the end. I spent too much time being stuck on part 4, when I ran GUIController, the I couldn’t move the cheeses in the animation. It turns out that I made cheese_location return a number of cheeses instead of a number of stools. Such a small mistake nearly drove me crazy. Moving on to step 5 - I had a day left to finish the assignment. Tour.py wasn’t any easier but thankfully I made no minor errors so I could move along with a steady pace. Thankfully I had time for the bonus question which was interesting. To complete the very long method (same_strategy) I had to use a for loop within a for loop within a for loop to satisfy all the necessary conditions and I was ecstatic to see it work! I do however wish I would’ve started this assignment sooner than I’d like to admit - this always starts off as my goal. The lab was easy this week (thankfully). In this week’s lectures we learned about trees! Fun stuff. I learned how to build trees and about tree traversals. Time to study for the test! Bye
Saturday, 15 February 2014
Friday, 7 February 2014
Week 5: Namespaces
This week I learned about namespaces and the order that python searches for names; first local (within the function body starting at the innermost function - in cases that there are function within functions), then nonlocal then global and finally it looks for built-in names. During lecture, I had practice with predicting where python looks for names being called. I’ve learned to bind and rebind variables using statements like ‘nonlocal’ and how to unbind using ‘del something’ which erases the link between object and attribute. In this week’s lab, I practiced tracing recursion and writing two recursive functions that offered more insight on the process of recursion.
Subscribe to:
Posts (Atom)