Let's learn some new Python concepts! You have to generate a list of the first Fibonacci numbers, 0 being the first number. Then, apply the map function and a lambda expression to cube each Fibonacci number and print the list.
Concept:
- The map() function applies a function to every member of an iterable and returns the result. It takes two parameters: first, the function that is to be applied, and second, the iterables.
- Let's say you are given a list of names, and you have to print a list that contains the length of each name.
>> print (list(map(len, ['Tina', 'Raj', 'Tom'])))
[4, 3, 3]