You are viewing a single comment's thread. Return to all comments →
fibonacci = lambda x: 1 if x<=2 else fibonacci(x-1) + fibonacci(x-2)
x = int(input())
print(fibonacci(x))
Seems like cookies are disabled on this browser, please enable them to open this website
Recursion: Fibonacci Numbers
You are viewing a single comment's thread. Return to all comments →
fibonacci = lambda x: 1 if x<=2 else fibonacci(x-1) + fibonacci(x-2)
x = int(input())
print(fibonacci(x))