Last active
April 10, 2021 17:36
-
-
Save Joel-hanson/a5bffde7fe944944eecab9673b098c5b to your computer and use it in GitHub Desktop.
Find nth Fibonacci number using recursion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibonacci(n): | |
if n <= 2: | |
return 1 | |
return fibonacci(n - 1) + fibonacci(n - 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment