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