Created
July 5, 2021 16:31
-
-
Save islandjoe/0354a697997322b6595851b31d491394 to your computer and use it in GitHub Desktop.
Fibonacci Series in Python
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 fibo(n): | |
prev = n - 2 | |
current = n - 1 | |
base_case = (n == 1 or n == 0) | |
return n if base_case else fibo(prev) + fibo(current) | |
for n in range(10): | |
print(fibo(n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment