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.
cube=lambdax:x**3deffibonacci(n):# return a list of fibonacci numberslst=[0,1]ifn>=3:for_inrange(n-len(lst)):lst.append(lst[-1]+lst[-2])returnlstelifn==0:return[]else:returnlst[:n]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 →