We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is the method to make real fibonnaci
# complete the lambda function
def fibonacci(n):
a = 0
b = 1
c = []
for i in range(1,n+1):
c.append(a)
d = a + b
a = b
b = d
return c
# return a list of fibonacci numbers
cube = (lambda x: (x**3))
if name == 'main':
n = int(input())
print(list(map(cube, fibonacci(n))))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Map and Lambda Function
You are viewing a single comment's thread. Return to all comments →
This is the method to make real fibonnaci # complete the lambda function def fibonacci(n): a = 0 b = 1 c = [] for i in range(1,n+1): c.append(a) d = a + b a = b b = d return c
cube = (lambda x: (x**3))
if name == 'main': n = int(input()) print(list(map(cube, fibonacci(n))))