Input Format
One line of input: an integer .
Constraints
Output Format
A list on a single line containing the cubes of the first  fibonacci numbers.

hackerrank map and lambda function problem solution in python

Problem solution in Python 3 programming language.

# Enter your code here. Read input from STDIN. Print output to STDOUT
N = int(input())
A = [0,1]
for i in range(2,N): A.append(A[i-1]+A[i-2])        
print(map(lambda a: a*a*a,A)[:N])

Second solution

cube = lambda x: pow(x,3)# complete the lambda function 
def fibonacci(n):
    # return a list of fibonacci numbers
    lis = [0,1]
    for i in range(2,n):
        lis.append(lis[i-2] + lis[i-1])
    return(lis[0:n])
if __name__ == '__main__':
    n = int(input())
    print(list(map(cube, fibonacci(n))))

Problem solution in Python 2 programming language.

# Enter your code here. Read input from STDIN. Print output to STDOUT
N = int(raw_input())
A = [0,1]
for i in range(2,N): A.append(A[i-1]+A[i-2])        
print map(lambda a: a*a*a,A)[:N]