You are viewing a single comment's thread. Return to all comments →
cube = lambda x:x**3
def fibonacci(n): # return a list of fibonacci numbers f = [0] a, b = 0, 1
if n == 0: return [] else: for i in range(1, n): a, b = b, a + b f.append(a) return f
if name == 'main': n = int(input()) print(list(map(cube, fibonacci(n))))
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 →
cube = lambda x:x**3
def fibonacci(n): # return a list of fibonacci numbers f = [0] a, b = 0, 1
if name == 'main': n = int(input()) print(list(map(cube, fibonacci(n))))