In this lesson, you will learn how to apply functional programming
within Python. First you will learn about employing the map, filter, and
reduce methods. Second, you will learn about lambda functions, which are
small, anonymous functions, that can simplify many functional
programming tasks. Note that many of the readings use Python2, so keep
that in mind when trying these concepts out in Python3 (for example, use
the print
function, not the print
statement, and the reduce
function
is now in the itertools
module).
###Objectives ### By the end of this lesson, you will be able to:
- Understand the
map
function and how to use it effectively. - Understand the
filter
function and how to use it effectively. - Understand the
reduce
function and how to use it effectively. - Understand lambda functions and how to use them for functional programming.
Approximately 2 hours.
-
Functional programming in Python2.
-
Lambda functions in Python.
-
Functional Programming in Python article (don't worry yet about comprehensions).
-
Old article on Functional Programming in Python Part 1 and Part 2. Note that are using Python2.
When you have completed and worked through the above readings, please take the Week 11 Lesson 2 Assessment.