Today we’re going to be looking at functional programming in Python.
To start with, we’ll look at mathematical functions. These are in the form of f(x), which will only have one value. That means that for any given x, f(x) is always the same. However, multiple x can have the same f(x).
It is important to note that mathematical functions often do not behave like computer functions. Let’s design a mathematical function:

These are also called pure functions. These always produce the same output when given the same arguements.
In Python, we can use functions as values. This is not unique to Python, it is something interesting that can be done:

Python allows us to generate functions quickly through the lambda keyword. These are known as anonymous functions.
Although no name has been assigned to the function as it is defined, you can assign the function to a variable.

Higher order functions take other functions as arguments and operate on them, or return functions as results:

Functional operations are a way of applying a function to every element of a collection. Let’s examine this with respect to map:

Under this bracket of functional programming comes list comprehensions. This is a quick and easy way of applying some operations to some group of objects:

Next time
That’ll about do it for this lesson. Next time we’ll be looking at data visualization in Python.