Here’s how you can use the built-in functions map(), filter() and reduce() functions in Python:
1. map() function:
The map() function applies a given function to each item of an iterable (such as a list or a dictionary) and returns a list of the results.
Example:
```
def multiply_by_two(n):
return n * 2
numbers = [1, 2, 3, 4]
result = map(multiply_by_two, numbers)
print(list(result))
1. filter() function:
The filter() function constructs a list from elements of an iterable for which a function returns true.
Example:
```
def is_even(n):
return n % 2 == 0
numbers = [1, 2, 3, 4]
result = filter(is_even, numbers)
print(list(result))
1. reduce() function:
The reduce() function, which is part of the functools module, continually applies a function to a sequence (e.g., a list), and returns a single value.
Example:
```
from functools import reduce
def multiply(a, b): return a * b
numbers = [1, 2, 3, 4]
result = reduce(multiply, numbers)
print(result)
Note: reduce() is not a built-in function since Python 3.0, so you have to import it from the functools module.