## Python’s “map” method and permutations of lists

Let’s look at Python’s map function. What does this function do? Here is the syntax:

1 |
map(function, iterable, ...) |

It takes a function called function and applies it to each element of iterable, returning the result as an iterable. For example:

1 2 3 4 5 |
myList = [1,2,3,4] myList = map(lambda x:x**2 ,myList) for i in myList: print(i) |

The output of this program is:

1 2 3 4 |
1 4 9 16 |