Introduction to Python – Class 7 – Functions

Dear Reader,

This is the 8th week of classes that I have taught at the CIC for health innovators, a health incubator/accelerator.  There are currently 3 lessons remaining for the series to be completed.

Last class, we covered basic concept of functions:

Class Slides 7

Class Code 7

In the class, we start with a very basic function with no return statement or parameters.  We then add more “features” to the function.  We begin with return statements, then go through different types of parameters and end with a discussion of variable scope.  Variable scope explores how variables interact with functions.  The last topic covered is import statements and packages.  We get into a discussion of how pip works and what PyPI is.

I didn’t cover the advanced section of the course, which goes over lambdas, decorators, recursion, memoization and closures.  Class 8 will cover these subjects and then go through 2 examples: 1. Medical Records processing example and 2. CLI builder tool called “Click”, which extensively uses decorators.  The later two projects will be considered part of Class 8.

I really wanted to get into some of Peter Norvig’s work.  Since I didn’t cover it in class, I will add it as suggested article below:

Peter Norvig’s Sudoku

 

Best,

Chris

 

Leave a Reply

Your email address will not be published. Required fields are marked *