Created
July 29, 2017 15:48
-
-
Save Nick0603/18ccf6be963f5559409a347d15a410e0 to your computer and use it in GitHub Desktop.
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 fibonacci(n): | |
if n == 1: | |
return 1 | |
elif n == 2: | |
return 2 | |
else: | |
return fibonacci(n-2) + fibonacci(n-1) | |
ans = fibonacci(50) | |
print("十階總共有 %d 種可能的走法"%ans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment