Friday, February 26, 2016

Week 6 SLOG

The focus of the week 6 lab exercise was the relationship between loops and list comprehension. By reimplementing dot_product, matrix_vector_product and pythagorean_triples functions that were written in list comprehension, I started to understand the purpose and convenience of using list comprehension. Instead of using for and while loops to implement a certain function, list comprehension condensed the task into nearly one line even though it serves the same purpose. In addition, the new concept of using filter to filter out elements and to reduce lists was interesting. The fact that there are many builtin functions that make operations convenient is amazing.

Friday, February 12, 2016

Week 5 SLOG

Week 5 was a very hectic week with assignment 1 and term test 1. Designing the layout of assignment 1 took a pretty long time since there were many classes that work together to run the whole ride simulation program. The most time-consuming and confusing part was writing the docstring examples for each function.
Also, while studying for the term test using past tests, I realized that I still have difficulty designing a completely new class. I had a hard time understanding the purpose of each function and how it should be implemented for the entire class to work. I solved this confusion by practicing more problems and trying out examples to get used to designing classes. However I still have some confusion in differentiating when and when not to use property to redirect client access. 

Friday, February 5, 2016

Week 4 SLOG

The main concept of week 4 was linked lists. Linked lists consist of nodes that are made up of the data value and its successor next_. The common pattern in linked lists was the method of making a reference to a node, usually called current_node, to move along the entire linked list. However, the most confusing part that I had trouble with was writing the code for def _getitem_. If an item is found, then it is not necessary to move further along the list. Using a flag to keep track if the item has been found was at first very hard to grasp. When appending and prepending to the list, I constantly forgot to check self.back and self.front. In addition, using "assert" to raise an error was very confusing. However, drawing pictures to simulate the situation helped in understanding how the function works and solving the confusion.