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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment