You are viewing a single comment's thread. Return to all comments →
cube = lambda x: x ** 3
def fibonacci(n): a,b=0,1 count = 0 while count < n: yield a a,b=b, a+b count+=1
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
I agree to HackerRank's Terms of Service and Privacy Policy.
Map and Lambda Function
You are viewing a single comment's thread. Return to all comments →
cube = lambda x: x ** 3
def fibonacci(n): a,b=0,1 count = 0 while count < n: yield a a,b=b, a+b count+=1
if name == 'main': n = int(input()) print(list(map(cube, fibonacci(n)))) `