Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pmbhatiya authored Mar 24, 2020
1 parent 343e5a5 commit e7fea7b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Map-and-lambda-function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Map and Lambda function in python Hackerrank solution

cube = lambda x: x**3
# complete the lambda function

def fibonacci(n):
# return a list of fibonacci numbers
fibo=[0,1]
for i in range(2, n):
fibo.append(fibo[i-1] + fibo[i-2])

return(fibo[0:n])



if __name__ == '__main__':
n = int(input())
print(list(map(cube, fibonacci(n))))

0 comments on commit e7fea7b

Please sign in to comment.