Py Functional — Free Python Tutorial
Learn Py Functional in Python with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
TL;DR: Learn Py Functional in Python with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated
Py Functional in Python
Python supports functional programming through map(), filter(), reduce(), and zip(). These eliminate explicit for loops for common transformation and aggregation patterns.
map(fn, iterable) transforms every element. filter(fn, iterable) keeps elements where fn returns True. Both return lazy iterators.
functools.reduce(fn, iterable) accumulates: applies fn to first two elements, then to the result and next element, and so on. zip() pairs elements from multiple iterables together.
Py Functional — Syntax
import functools squares = list(map(lambda x: x**2, [1,2,3,4])) # [1,4,9,16] evens = list(filter(lambda x: x%2==0, range(10))) # [0,2,4,6,8] total = functools.reduce(lambda a,b: a+b, [1..10]) # 55 pairs = list(zip([1,2,3], ['a','b','c'])) # [(1,'a'),...]
Learn Py Functional step by step with Syllab's free interactive Python tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Python course →