Created
January 30, 2018 09:11
-
-
Save vikychoi/9aba84d37042b126d2765cfa18e2e459 to your computer and use it in GitHub Desktop.
Returns value of requested term of Fibonacci number
This file contains 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 fibonnaci(x): | |
if(x == 1): | |
return 1 | |
elif(x == 0): | |
return 0 | |
else: | |
return fibonnaci(x -1) + fibonnaci(x -2) | |
number = int(input("Please entre the number of term of fibonnaci number")) | |
print("The number of ", number,"term of fibonnaci number is ", fibonnaci(number)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment