Chapter 12 Portfolio-Building Project, Functions

In the last chapter, you were asked to perform a complete work-through of a case study data set that you were already familiar with. This is fine, but we just wrote a script that progressed step-by-step through an analysis. There are probably a few areas where you could have recycled code by writing functions.

Exercise 12.1 (Code review) Review your portfolio-building solution from the previous chapter. Can you identify areas where you reused code that would be better served by defining it as a function?
Exercise 12.2 (Creating functions) Create a new text file and generalize your code to use functions where possible instead of straight-forward imperative programming that we have done thus far. e.g. you may have a variety of new functions, such as: def get_data(x, type) or get_indexes(type) and so on, depending on which part of your code you have functionalized.