...

/

Functional Programming Toolkit: Maps, Filters, and More

Functional Programming Toolkit: Maps, Filters, and More

Learn functional programming in Python.

While writing functional code will be your responsibility, Python also includes a number of tools for functional programming. These built-in functions cover the basics, and they should help you write better code:

map(function, iterable)

map(function, iterable) applies the function to each item in iterable and returns either a list in Python 2 or an iterable map object in Python 3:

Press + to interact
print(map(lambda x: x + 'bzz!', ['I think', 'I\'m good']))
## map wrapped in a list to print the list
print(list(map(lambda x: x + 'bzz!', ['I think', 'I\'m good'])))

filter(function or None, iterable)

filter(function or None, iterable) filters the ...

Access this course and 1400+ top-rated courses and projects.